Added domains middleware - adds heiarchy of domains and subdomains to request #770

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@johnhenry

Hello. I've added a new middleware application to Connect called Domains.

It adds an array of domains to the request object as req.domains.

The first item, req.domains[0], is the site domain and is determined by the argument passed into the middleware in the use statement, ie .use(connect.domains("example.com") or .use(connect.domains(2)).

All subsequent items are subdomains

I feel like this would be a welcomed addition to Connect.

@tj
Member
tj commented Apr 1, 2013

req.domains can just be a prototype method, no reason it has to be middleware really, express has req.subdomains for example. Or even if it's middleware we can keep it third-party for now and add it to the wiki

@tj tj closed this Apr 1, 2013
@johnhenry

Sounds good. And thanks for the heads up about req.subdomains in express.

@johnhenry johnhenry deleted the johnhenry:domains branch Apr 7, 2013
@johnhenry johnhenry restored the johnhenry:domains branch Apr 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment