I am new to ExpressJS and NodeJS in general, so I need guidance on how to achieve this effect:
app.get('/', 'sub1.domain.com', function(req, res) { res.send("this is sub1 response!"); }); app.get('/', 'sub2.domain.com', function(req, res) { res.send("this is sub2 response!"); }
So, when I request sub1.domain.com
, the first handler responds, and on sub2.domain.com
I get a response from the second handler. I read some questions about SO about using vhost for this purpose, but I would be happier if what I described above worked, rather than creating multiple server instances, for example in vhost.
Acute source share