JavaScript Express Basics Parameters, Query Strings, and Modularizing Routes Modular Routes

Shehan Dissanayake
Shehan Dissanayake
19,118 Points

app.use(routes);

What is the meaning of this line? Why do we pass routes in to app.use() method ?

1 Answer

routes is a bundle of detached routes and handlers (ie, a router). app.use attaches them to the main application. Read more about it in the documentation.