Relatively new to Node, so if I make a statement that is outright wrong, 
please let me know.

Let's say I have 3 Express apps over 2 domains:

*Default website*: www.domain.com (/hosts/www/app.js)
*Alpha API website*: api.domain.com/alpha (/hosts/api/alpha/app.js)
*Beta API website*: api.domain.com/beta (/hosts/api/beta/app.js)

I'm looking to build an infrastructure that allows me to handle routing all 
incoming requests through a central "AppRouter" that looks at the Protocol, 
Domain and Port combination (what I'm calling an 'endpoint') to know which 
app to route the request off to. For example, if it sees:

https://www.domain.com/this/that,

it'll know that: "With protocol 'https' and domain 'www.domain.com' and 
port: 80, I send this to the 'Default website' express app (which takes 
over from that point to process the '/this/that' or remainder of the path 
in the url.

My problem I'm encountering, is that in order to bring up a 'AppRouter' 
application, I have to specify a port to bind to. So if I bind it to port 
80, I'll miss all requests on https (443) or other ports I might want to 
support.

Am I taking the wrong approach to this functionality, or am I too complex 
in my approach? Does node support a more simplified approach to this 
problem like "Just spin up a node instance per app", etc.  I'm using a VPS 
hosting, and am new to it as well, so I appreciate any feedback from 
someone whose been in a similar situation.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/10c95cf8-cff5-4283-9d5c-283020a6a267%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to