02 / 02

What is routing?

Routing refers to determining how an application responds to a client request to a particular endpoint, which is a URI (or path) and a specific HTTP request method (GET, POST, and so on).

Route definition takes the following structure:
Where:
  1. 1

    app is an instance of express.

  2. 2

    METHOD is an HTTP request method, in lowercase.

  3. 3

    PATH is a path on the server.

  4. 4

    HANDLER is the function executed when the route is matched.