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:

  • server is an Express instance created using the top-level express() function.

  • METHOD is a function representing an HTTP verb.

  • PATH is a string representing a URN on the server.

  • HANDLER is a request listener function, also called a controller, that is executed when the route is matched.