@koex/onerror
v0.0.3
Published
onerror for koa extend
Downloads
10
Readme
onerror
onerror for koa extend.
Install
$ npm install @koex/onerror
Usage
// See more in test
import onerror from '@koex/onerror';
import * as Koa from 'koa';
const app = new Koa();
app.use(onerror());
// fallback
app.use(async (ctx) => {
const error = new Error('Unauthorized');
(error as any).status = 401;
throw error;
});
app.listen(8000, '0.0.0.0', () => {
console.log('koa server start at port: 8000');
});