0
我想在iis的子路由中托管我的nodejs服务器应用程序。我想要做的就是托管我的应用程序,例如localhost:3000/node/not localhost:3000 /。 这可以通过Nodejs - 托管子网路
改变端点从
app.get('/', moduleRoutes.root);
app.post('/auth/signup/', authenticationRoutes.signup);
来实现
app.get('/node/', moduleRoutes.root);
app.post('/node/auth/signup/', authenticationRoutes.signup);
,但我不希望每次我改变我的托管路径的时间来改变所有的API端点。
另一个是
app.use((req, res, next) => {
//change request location from here by changing
req.url = req.url.replace('localhost:3000/node/', 'localhost:3000')
//somthing like that
authorization.memberinfo(req, res, next);
});
但这看起来并不像一个适当的方式来实现这一目标。请指引我走向正确的方向。谢谢。