DEV Community

Kazi Abdur Rakib
Kazi Abdur Rakib

Posted on

Dynamic index: src/app/routes/index.ts

=> src/app/routes/index.ts

import { Router } from 'express';

const router = Router();

const moduleRoutes = [
  {
    path: '/pathname',
    route: routername,
  },
];

moduleRoutes.forEach((route) => router.use(pathname.path, routername.route));

export default router;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)