0.1.0 • Published 6 years ago

koa-error-lite v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

koa-error-lite

A minimal error-handler middleware for Koa apps

Build Status

This is the recommended Koa error handler published as an npm package. I always use this middleware in my Koa apps, so it made sense to make it reusable.

TypeScript declarations are included in the package.

Requirements

This middleware is designed specifically for Koa v2, and so it requires Node v7.4+ (due to the usage of async functions).

Installation

$ npm install koa-error-lite

Usage

const Koa = require('koa')
const errorHandler = require('koa-error-lite')

const app = new Koa()

// This middleware should be above any other middleware that you want to catch errors for.
app.use(errorHandler())

// Other middleware...

License

MIT