express-booter
Express routes booter and middlewares
Install
npm i express-booter
Usage
Boot routes
const boot = ;;
Boot options
const options = /\.js$/ console safe: false;
Route definition
moduleexports = name: '/users' // top level middlewares middlewares: { // TODO: } list: name: '/' method: 'get' // handler level middlewares middlewares: { // TODO: } { // TODO: } get: name: '/:id' method: 'get' { // TODO: } create: name: '/' method: 'post' { // TODO: } ;
Guards
const guards = ;// Validate fielda in request bodyrouter;router;router;router;router;// Validate fields in request query stringsrouter;// Validate fields in request headersrouter;// Validate fields in request parametersrouter;// Success if current running NODE_ENV maches anyrouter;// Extract user entity from requestrouter;// Parse pagination options from query stringrouter;// Parse filter options from query stringrouter;// Parse sort options from query stringrouter;// Parse projection options from query stringrouter;// Check authorization headerrouter;
Errors
const errors = ;// 400throw message;// 401throw message;// 403throw message;// 404throw message;// 409throw message;// 410throw message;// 500throw message;// 501throw message;
Test
npm test
License
See License