Populate the req.subdomains array. For example "ferret.tobi.example.com" would yield ['tobi', 'ferret'].
req.subdomains
['tobi', 'ferret']
module.exports = function(){ return function subdomains(req, res, next){ req.subdomains = req.headers.host .split('.') .slice(0, -2) .reverse(); next(); }; };
Subdomains
Populate the
req.subdomainsarray.For example "ferret.tobi.example.com"
would yield
['tobi', 'ferret'].Source