http-status
A simple boilerplate for es6/es7 project, you can start your npm module from this.
Only with neccessary key features:
- babel
- commitlint
- eslint
- flow
- husky
- jest
- prettier
- remark
- standard-version
Usage
npm i --save @south-farm/http-status
in your js file
import httpStatus from "@south-farm/http-status";
// or
// import NotFound from "@south-farm/http-status/not-found";
(req, res, next) => {
const err = new httpStatus.NotFound();
res.status(err.statusCode).json(err);
};
All deinfed error
- InvalidRequest: 400
- Unauthorized: 401
- Forbidden: 403
- NotFound: 404
- NotAcceptable: 406
- Gone: 410
- UnprocessableEntity: 422
- InternalError: 500