restify-routing-middleware-applier
v1.1.0
Published
Library to apply middlewares to a set of routes
Downloads
5
Maintainers
Readme
restify-routing-middleware-applier
Library to apply middlewares to a set of routes
Usage
const restify = require( 'restify' );
const withMiddlewares = require( 'restify-routing-middleware-applier' );
function middleware1( req, res, next ) {
// do something...
}
function middleware2( req, res, next ) {
// do something...
}
const server = restify.createServer();
server.get( '/routeWithoutMiddlewares', ( req, res, next ) {
// do something...
} );
withMiddlewares( server, middleware1, middleware2, customServer => {
customServer.post( '/routeWithMiddlewares', ( req, res, next ) => {
// do something...
} );
} );