Route HTTP requests in Express
Express·1 min read·Jan 15, 2026
In web development, routing refers to the mechanism by which a web application determines how to process and respond to the requests sent by clients on a specified endpoint, which as a reminder, is a mapping between a specific HTTP method and a URL.
Declare routes
In Express, each endpoint (or route) is individually declared using this syntax:
server.METHOD(PATH, HANDLER)Where:
-
serveris an Express instance created using the top-levelexpress()function. -
METHODis a function representing an HTTP verb. -
PATHis a string representing a URN on the server. -
HANDLERis a request listener function, also called a controller, that is executed when the route is matched.