Error handler middleware for micro.
npm install --save @mariusc23/micro-error-handler
const { applyMiddleware } = require('@mariusc23/micro-middleware')
const { errorHandler } = require('@mariusc23/micro-error-handler')
module.exports = applyMiddleware([errorHandler], async (req, res) => {
return 'Hello world'
})
{
"error": {
"code": 500,
"message": "Unknown Error"
}
}
Copyright (c) 2017 Marius Craciunoiu. Licensed under the MIT license.