Create a new router
Course: PayTM project - chapter 12
1. Create a new router
Section titled “1. Create a new router”All user balances should go to a different express router (that handles all requests on /api/v1/account ).
Create a new router in routes/account.js and add export it
Solution
const express = require('express');
const router = express.Router();
module.exports = router;2. Route requests to it
Section titled “2. Route requests to it”Send all requests from /api/v1/account/* in routes/index.js to the router created in step 1.
Solution
const express = require('express');const userRouter = require("./user");const accountRouter = require("./account");
const router = express.Router();
router.use("/user", userRouter);router.use("/account", accountRouter);
module.exports = router;