http-client-decorator
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Http Client Decorator

web http client decorator

Installation

Yarn

yarn add http-client-decorator

NPM

npm install http-client-decorator --save

Getting Started

Http client is use Axios

@Http(options)  //options is Axios.create options
class Test {
  @Get('url',{data},{config})     //config is instance.request config
  method1(@Res res?) {
  }
  @Post('url',{data},{config})
  method2(@Res res?) {
  }
  @Fetch(RequestMethod.PUT,'url',{data},{config})
  method3(@Res res?) {
  }
}

RequestMethod is a enum

enum  RequestMethod {
  GET = 'GET',
  POST = 'POST',
  HEAD = 'HEAD',
  PUT = 'PUT',
  DELETE = 'DELETE',
  OPTIONS = 'OPTIONS',
  PATCH = 'PATCH',
}

That's it!

Package Sidebar

Install

npm i http-client-decorator

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

12 kB

Total Files

16

Last publish

Collaborators

  • skunight