frontexpress/docs/router.md
Camel Aissani be20f98498 added docs
2016-07-23 00:02:34 +02:00

767 B

Router

Router.use(middleware)

Use the given middleware function or object on this router.

   // middleware function
   router.use((req, res, next) => {console.log('Hello')});

   // middleware object
   router.use(new Middleware());

Parameters

middleware: Middleware | function, Middleware object or function

Returns: Router, for chaining

Router.all(middleware)

Use the given middleware function or object on this router for all HTTP methods.

   // middleware function
   router.all((req, res, next) => {console.log('Hello')});

   // middleware object
   router.all(new Middleware());

Parameters

middleware: Middleware | function, Middleware object or function

Returns: Router, for chaining