What are Routes?
Routes are URL schema, which describe the interfaces for making requests to your web app. Combining an HTTP request method (a.k.a. HTTP verb) and a path pattern, you define URLs in your app.
Each route has an associated route handler, which does the job of performing any action in the app and sending the HTTP response.
Routes are defined using an HTTP verb and a path pattern. Any request to the server that matches a route definition is routed to the associated route handler.
Route handlers are middleware functions, which can send the HTTP response or pass on the request to the next middleware in line. They may be defined in the app file or loaded via a Node module.
A quick introduction to HTTP verbs
The HTTP protocol recommends various methods of making requests to a Web server. These methods are known as HTTP verbs. You may already be familiar with the GET
and the POST
methods; there are more of them, about which you will learn in a short while.
Express, by default, supports...