circe-response-api
v0.0.3
Published
## 安装
Downloads
2
Readme
circe-response-api 拓展api
安装
使用
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