koa-better-boom
v1.0.1
Published
Boom response objects in Koa.js ⛑.
Downloads
2
Maintainers
Readme
koa-better-boom
Boom response objects in Koa.js ⛑ (inspired from express-boom).
Installation
# npm
$ npm install koa-better-boom
# yarn
$ yarn add koa-better-boom
Usage
This is a practical example of how to use.
const Koa = require('koa')
const koaBoom = require('koa-better-boom')
const app = new Koa()
app
.use(koaBoom())
.use((ctx) => {
// ==> ctx.boom.badRequest()
// ==> ctx.response.boom.badRequest()
ctx.boom.badRequest()
})
Note
For a complete list of methods, see the Boom docs.