Apache and Node.js have something in common. The more I use Node.js, the more I like Node.js; similarly, more I use Apache, the more I like Node.js.
One good thing about Apache though, it can do a lot of things through the same port. PHP, Python, Perl, different apps, different paths, the whole magilla. Node.js doesn't do that, and it isn't supposed to but I would like to do something similar.
I would like to give it a list of URL-prefixes (or regexps ideally) and enough information to, if it receives a request matching a particular prefix, it passes off the request to a subordinate instance running a specified script (and it will start such an instance if it hasn't already, and close it down when doing so seems prudent). Basically, I want nodejs-proxy
and cluster
cooperating. With it, I could run several apps together on the same machine through port 80.
This seems pretty easy and very useful and I was about to just write it myself when it occurred to me, "This seems pretty easy and very useful -- probably someone has already written it!" Any suggestions?
Node.js doesn’t have any built-in ability to route requests to different applications, but frameworks like this are in development.
Nodejitsu’s Haibu comes to mind — it manages child processes for each application and uses node-http-proxy to route the requests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With