For example, if you start a static server like this:
var http = require('http'); var static = require('node-static'); var file = new static.Server('dir1'); http.createServer(function(req, res) { file.serve(req, res); }).listen(80); console.log('Server running on port 80'); when a person enters mysite.ru data from the dir1 folder will be sent to him.
How to write the similar code, but that files were issued when entering a subdomain.mysite.ru ?
http.createServer(function(req, res) { var host = req.get('host'); if (host === 'subdomain.mysite.ru') file.serve(req, res); }).listen(80);- KoVadimTypeError: req.get is not a function. - pank