Sub domains in nodejs
问题 How can I handle subdomains request by nodejs? for example the following code echo test in console for any request on http://localhost:9876/[anything] : var http = require('http'); http.createServer(function(req, res){ console.log("test"); }).listen(9876); now I wanna answer any request on http://[anything].localhost:9876/[anything] it can be done by htaccess in apache,what is alternative in NodeJS? 回答1: Your application is already capable of handling requests for multiple hosts. Since you