Express vhost正在继承其他路由

Express vhost正在继承其他路由,express,vhosts,Express,Vhosts,我试图为每个vhost使用一组不同的路由 module.exports = function(app) { app.use(vhost('www.example.com', exampleRoutes)) app.use(vhost('*.example.com', subdomainRoutes)) } 我的问题是www.example也在使用来自子域路由的路由 我需要以某种方式指定,如果我在www下,那么只有exampleRoutes可以工作 更新。看起来我可以使用re

我试图为每个vhost使用一组不同的路由

module.exports = function(app) {

    app.use(vhost('www.example.com', exampleRoutes))
    app.use(vhost('*.example.com', subdomainRoutes))

}
我的问题是www.example也在使用来自子域路由的路由 我需要以某种方式指定,如果我在www下,那么只有exampleRoutes可以工作

更新。看起来我可以使用regexp。我需要像这样的东西


不是(www.example.com),但我对regexp很糟糕:(

把它放在这里,以防有人需要它

const regex = new RegExp('^(?!.*www.example.*).*$');
app.use(vhost(regex, subdomainRoutes))