circe-response-api
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

circe-response-api 拓展api

安装

NPM

使用

import * as Koa from 'koa'
import responseApi from 'circe-response-api'
 
const app = new Koa()
 
responseApi(app.context)
 
app.use(async () => {
  app.success(data) // 200
  app.fail(data) // 200
  app.error(status) // status
})

API

  • function success(data?: string | {[name: string]: any}): any
  • function fail(data?: string | {[name: string]: any}): any
  • function error(status?: number): void

Readme

Keywords

none

Package Sidebar

Install

npm i circe-response-api

Weekly Downloads

2

Version

0.0.3

License

MIT

Last publish

Collaborators

  • sikichan2
  • varharrie