expressjs/vhost — pull request #3 by chucklam (2014-05-26 06:00:09+00:00)
Title: Wildcard matching should pass on the matched subdomain name

1) For wildcard matching, I refactored and added a couple more tests to ensure that matching is done in the order the vhosts are added. Nothing unexpected here. Just some clarification.

2) When using wildcard to match subdomains, I'd like to know the subdomain name that was matched. For example, I may have one server serving www.example.com while another one serving other subdomains like john.example.com, larry.example.com, and moe.example.com. In the second case I want to know whether I'm serving john, larry, or moe. I decide to return that as a string in req.vhost.
In principle one can use multiple wildcards, so there can be multiple matched parts. I imagine that's a really rare use-case though, so I focused on returning just the first match and make it user-friendly for that case. I'm open to discussion though.