Expressjs Routing

Routing determines 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).

Each route can trigger one or more handler functions, which are executed when the route is matched.

Route definition takes the following structure:

app.METHOD(PATH, HANDLER);

In the above line
> app is the instance of express
> Method is an http request method (get, post)
> Path is the path on server
> Handler is the function that will be executed on route matching

const express = require("express");

const app = express();

app.get("/", (req, res) => {
res.send("Home Page");
});

app.get("/about", (req, res) => {
res.send("About Page");
});

app.get("/users", (req, res) => {
res.send("Users Page");
});

app.listen(3000);

Now if your server is running on port 3000:

http://localhost:3000/
returns: Home Page

http://localhost:3000/about
returns: About Page

http://localhost:3000/users
returns: Users Page

For details please review as follow

https://github.com/KoolMonk/mern-alfa/blob/master/server/routes/userRoutes.js