Yoctol/koa-final-handler

Name: koa-final-handler

Owner: YOCTOL INFO INC.

Description: Final handler middleware for koa.

Created: 2018-05-05 16:03:55.0

Updated: 2018-05-14 07:18:57.0

Pushed: 2018-05-14 07:18:56.0

Homepage: null

Size: 53

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

koa-final-handler

Final handler middleware for koa

Installation

Install using npm:

install @yoctol/koa-final-handler
Usage
t Koa = require('koa');
t finalHandler = require('@yoctol/koa-final-handler');

t app = new Koa();

use(finalHandler());
sing other middleware after this line */
use(auth());
use(route());

listen(8080, () => {
nsole.log('server is running on http://localhost:8080');

Response Body

The middleware will append error object on response body when NODE_ENV is development.

t { error } = response.body;
Error Reporting
t handleErrorReporting = (error, ctx) => {
 your error reporting handler */


on('error', handleErrorReporting);

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.