Router
noun
say it: “ROW-ter” /ˈraʊtər/
An Express object that groups related routes, often in their own file, and is mounted under a path.
What is Router?
express.Router() groups related routes in their own file, mounted under a path.
const recipes = express.Router();
recipes.get('/', listRecipes);
app.use('/recipes', recipes);
In a sentence
- “Mounting the Router at /games makes its "/" route answer /games.”
- “The tickets Router holds every /tickets route in routes/tickets.js.”
Level: Journeyman · More Node.js terms at this level
Updated