Info: I am very new to node.JS!
I have written a sample server that can listen to http requests on port XXXX. When I run this server from commandline (Windows) it seems to work well. It responds to the requests made to localhost:XXXX when opened in a browser.
Question: Is this how this is supposed to work? For the node server to run, should there always be a CMD prompt open for the server to listen to requests? Can I not do "something" with IISNode?
I understand that if I make a request to a JS files, which is noted in IISNode as a Node.JS file and that NODE should be handling it; then I will have Node handling the request for me. But then this assumes that IIS is the web server for me and that specific requests can be handled by Node.
I hope I am making sense here! :)
Node. js provides capabilities to create your own web server which will handle HTTP requests asynchronously. You can use IIS or Apache to run Node. js web application but it is recommended to use Node.
On Windows you have two options of hosting node.js applications:
I solved it using a proper method. Yes, IISNode it is.. But none of comments seemed to answer how to "run" app.js for different applications hosted on same IIS (which is also serving PHP, ASPX, etc)
Step 1. Edit your node application’s entry-point (typically) app.js for the new URL structure.
An express app assumes that it owns the entire URL space and starts the URLs from the root itself, as shown:
Edit you app.js to look like the following (but put YOUR app’s directory name instead of “aaspass”!!):
Now put a web.config file at the root of your app which looks like the following (You may use this template: webconfig).
Again edit the file and change the name “aaspass” to your app’s directory name.
Thats it! You may do this for as many apps as required and host them on SAME server.
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