【发布时间】:2019-03-10 20:00:43
【问题描述】:
我有一个应用程序作为 something.localhost (*.localhost) 运行,具体取决于需要识别的子域名操作。
【问题讨论】:
标签: node.js node-modules
我有一个应用程序作为 something.localhost (*.localhost) 运行,具体取决于需要识别的子域名操作。
【问题讨论】:
标签: node.js node-modules
您可以使用req.headers.host 来识别主机。
app.get('*', (req, res, next) => {
if(req.headers.host == 'something.localhost') {
//your code here
}
});
【讨论】: