mirror of
https://gitlab.silvrtree.co.uk/martind2000/frontexpress.git
synced 2025-01-12 05:15:07 +00:00
767 B
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