Open In App

Express.js Router Complete Reference

Last Updated : 01 Nov, 2023
Like Article

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: 



Express.js router.all() Function

The router.all() function is just like the router.METHOD() methods, except that it matches all HTTP methods (verbs).

Express.js router.METHOD() Function

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.

Express.js router.param() Function

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.

Express.js router.route() Function

The router.route() function returns an instance of a single route that you can then use to handle HTTP verbs with optional middleware.

Express.js router.use() Function

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

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads