Courses / Node.js
6. Express app and Router() instantiation
Create an Express application and use express.Router to organize route handlers.
1 min read Chapter 6 of 48
JavaScript
Express app and Router() instantiation
A way to create an Express application and group related routes using express.Router().
"I want my API routes grouped and mounted so my main file stays clean."
express() creates the main app instance that listens for requests; express.Router() creates a mini-app to collect related routes which you mount on the main app.
"I want my API routes grouped and mounted so my main file stays clean."
express() creates the main app instance that listens for requests; express.Router() creates a mini-app to collect related routes which you mount on the main app.