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.

Unlock the program 🚀

Pay once, own it forever.

€79

30-day money-back guarantee

  • 13 modules
  • 113 lessons with full-code examples
  • 29 projects with commented solutions
  • All future lesson and project updates
  • Lifetime access

By submitting this form, you agree to the Terms & Conditions and Privacy Policy.