Open In App

Express.js Router Complete Reference

Improve
Improve
Like Article
Like
Save
Share
Report

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: 

Methods 

Description

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


Last Updated : 01 Nov, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads