0.0.3 • Published 7 years ago

circe-response-api v0.0.3

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

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