Reputation: 12652
I am using node.js, and my server only has one port open for me to use node.js on. And no, I cannot open more ports. Because I am using this same server for testing and production and it seems like it would be more convenient, I want to be able to have node.js "pages", like in php. Basically, if the url is something, I want the code in one node.js file to be executed. If the url is something else, I want a different node.js script to be run. I want it so that if one page crashes, the rest of the website stays up. I think there might be a way to do this with express, but I'm not sure and I don't know how to do it.
Upvotes: 0
Views: 13843
Reputation: 24676
You're on the right track with express. You want to use routes within express. Check out:http://expressjs.com/api.html#app.VERB
Also check out: http://elegantcode.com/2012/01/20/taking-toddler-steps-with-node-js-express-routing/
Upvotes: 1