koa-utils
v0.0.4
Published
Various utils for koa
Downloads
21
Readme
Koa Utils
Slim Boilerplate for TypeScript based projects.
Installation
# npm
npm install --save koa-utils
# yarn
yarn add koa-utilsUsage
const Koa = require("koa");
const { handleErrors } = require("koa-utils");
// Create server with error handler
const server = new Koa()
.use(handleErrors());
server.listen(8080, () => console.log("Server started"));handleErrors
Generic error handler for rest apis. Creates a response with the following structure:
ErrorResponse {
result: null,
messages: ["A user friendly message"];
success: false;
errors: [{ code: 123, "Something is wrong" }];
}License
MIT, see LICENSE.
