@kever/response
TypeScript icon, indicating that this package has built-in type declarations

1.2.4 • Public • Published

@kever/response

a kever property plugin, standard response output format.

Install

npm install @kever/response --save

Start

//index.ts
import { createApp } from '@kever/core'

createApp({
  port: 9000,
  plugins: [
    '@kever/response'
  ]
})
// controller.ts
import { BaseController, Context, Controller } from '@kever/core'
import { PluginType, UsePlugin } from '@kever/ioc'
import { Get } from '@kever/router'
import { Response } from '@kever/response'

@Controller('/')
export class Controller extends BaseController {

  @UsePlugin(PluginType.property, 'response')
  private response: Response

  @Get('/index')
  async index(ctx: Context) {

    ctx.body = this.response(ctx, 10000, {
      name: 'kever',
      message: 'Hello world'
    })
  }
}

Readme

Keywords

Package Sidebar

Install

npm i @kever/response

Weekly Downloads

1

Version

1.2.4

License

MIT

Unpacked Size

7.54 kB

Total Files

7

Last publish

Collaborators

  • hubvue