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.

results matching ""

    No results matching ""