更新时间:2023-12-01 10:53:58
您可以为此使用 express Router().
You can use the express Router() for this.
您可以像使用 Express 应用程序一样使用路由器.例如:
You can use the router like you would use your express app. So for example:
router.use(() => {}); // General middleware
router.get('/route1', () => {})
router.get('/route2', () => {})
router.post('/route2', () => {})
然后使用以下命令将路由器连接到您的 Express 应用程序:
And then attach the router to your express app using:
app.use('/prefix', router);