Skip to content

Latest commit

 

History

History
5 lines (4 loc) · 488 Bytes

routing.md

File metadata and controls

5 lines (4 loc) · 488 Bytes

Using Express.Router

We have lots of Routes in server.js, we can use the express.Router class to create modular, mountable route handlers. A Router instance is a complete middleware and routing system; for this reason, it is often referred to as a “mini-app”. https://expressjs.com/en/guide/routing.html#express-router

Exercise: Use express.Router to organise the routes in server.js in a more modular fashion. Write your new file under /routes/site-routes.js.