To add a catch all route for everything except for /login with Node.js Express, we add the route for /login before adding the catch all route.
For instance, we write
app.get("/login", (req, res) => {
//...
});
app.get("/", (req, res) => {
//...
});
app.get("*", (req, res) => {
//...
});
to add get routes for the /login and / URLs before adding the catch all route to let the higher route handlers handle requests to /login and /.