Express.js Router Complete Reference
Express.js is a small framework that works on top of Node.js web server functionality to simplify its APIs and add helpful new features. It makes it easier to organize your application’s functionality with middleware and routing.
Express.js Router Methods:
The router.all() function is just like the router.METHOD() methods, except that it matches all HTTP methods (verbs).
|
The router.METHOD() method provides the routing functionality in Express, where METHOD is one of the HTTP methods, such as GET, PUT, POST, and so on, in lowercase.
|
The parameters of router.param() are a name and function. Where the name is the actual name of the parameter and the function is the callback function.
|
The router.route() function returns an instance of a single route that you can then use to handle HTTP verbs with optional middleware.
|
The router.use() function uses the specified middleware function or functions. It basically mounts middleware for the routes that are being served by the specific router
|
Last Updated :
01 Nov, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...