Skip to content
This repository has been archived by the owner on Jan 25, 2020. It is now read-only.

Creating routes for subdomains #68

Closed
andrewapperley opened this issue Apr 22, 2015 · 2 comments
Closed

Creating routes for subdomains #68

andrewapperley opened this issue Apr 22, 2015 · 2 comments

Comments

@andrewapperley
Copy link

I've searched through the current codebase but do not see any support for registering routes based off of a subdomain as I have a requirement for this and cannot run multiple servers.

For example:

api.service.com/ => api/index.js

Is this on the roadmap or should [I / a contributor] go ahead and work on this functionality?

@totherik
Copy link
Member

@andrewapperley sorry for the delay in reply. This isn't currently on the roadmap, so any help you'd be able to offer would be much appreciated. Curious on your thoughts as to how to approach this.

@andrewapperley
Copy link
Author

Hey @totherik don't worry about it, I pulled the issue because I was coming to the conclusion that subdomain handling is more appropriate as a middleware on every request and not to be handled at the route creation level. However it should be possible but I haven't nailed down how to do it quite yet. Checking every request if its coming from a subdomain is hacky in my opinion (how a few middleware projects handle this so far). I'll comment back when I've given this some more time but my first thoughts are to add a second option in the config for another folder that would house the controllers or change how directory.js searches for controllers.

Have the folder structure more like this:

controllers
    domains
        /
            admin
            about
        api
            v1
etc...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants