-
-
Save mauricionobrega/1da5b9291f94510402af2b0559884bbb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getSubdomain(h) { | |
| var parts = h.split("."); | |
| if(parts.length == 2) return "www"; | |
| return parts[0]; | |
| } | |
| //later on... | |
| exports.index = function(req, res) { | |
| var subdomain = getSubdomain(req.headers.host); | |
| res.render('index', { title: 'Express', subdomain:subdomain }); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment