我是Expressjs和NodeJS的新手,所以我需要有关如何实现这种效果的指示:
app.get('/','sub1.domain.com',function(req,res) { res.send("this is sub1 response!"); }); app.get('/','sub2.domain.com',res) { res.send("this is sub2 response!"); }
因此,当我请求sub1.domain.com第一个处理程序作出反应时,在sub2.domain.com上我得到第二个处理程序的响应.我已经阅读了有关使用vhost实现此目的的一些问题,但如果我上面描述的内容有效而不是像在vhost中创建多个服务器实例那么我会更高兴.