1.0.5 • Published 3 years ago

got-plus v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

got-plus

  • got-plus is based on Got‘s Network request package
  • You only need to define the request method to use, Just like Openfegin
  • You can simply use network requests through annotations
  • Currently only supports application/json input and output, future versions will expand Got's more implementations

Guide

1. Use got-plus in JS

2. Use got-plus in TS

Use E.g

// Use E.g
/**
 * define a get request
 **/

@RequestMapping({
     url: 'http://third-service-host/id/{id}/name/{name}',
    method: RequestMethod.GET,
})
async myThirdGet(
    @Header() header, // HeaderSetting
    @PathVariable({ name: 'id' }) id, // PathParam
    @PathVariable({ name: 'name' }) name, // PathParam
    @QueryParam() query, // Queryparam
) {}

/**
 * define a put request
 *  
 **/
@RequestMapping({
    url: 'http://third-service-host/id/{id}',
    method: RequestMethod.PUT,
})
async myThirdPut(
    @Header() header, // HeaderSetting
    @PathVariable({ name: 'id' }) id, // PathParam
    @QueryParam() query, // Queryparam
    @Body() body, // Queryparam
) {}