How to run node js programs

Discussion in 'Windows / IIS' started by Datatron, Aug 29, 2015.

Tags:
  1. What is the procedure for executing a node js program from the server of DiscountAsp? On my local server I set up a command in my js program as follows: http.createServer(onRequest).listen(8888); I then enter http://localhost/8888?id=1234 to execute my program. What is the equivalent procedure on the discountasp server? I am using node js to create a web service that I will access from my android app and need to know what type of url to access from my app.
     
  2. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    mjp likes this.
  3. I did read your blog. On my local server I type in "node index.js" on the command line to activate my node js program. Is entering "<add name="iisnode" path="*index.js" verb="*" modules="iisnode" />" in my web config file doing the same thing which means it is continually running? If so, if I have mulitple node programs running in a directory called "mynode" do I then enter <add name="iisnode" path="/mynode/*.js" verb="*" modules="iisnode" /> in my web.config file?
     
  4. Also, what url do I use to access my web service if I set my listener to 8888 for example? Now I use http://localhost/8888. What would I use on the discountasp server if my website url is http://myurl.com for example?
     
  5. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    Sort of. It should spawn a process when node.js is invoked.

    You shouldn't need to add /mynode/ as the web.config configuration settings should propagate down, but if it doesn't work, then you can give it a try.

    You can't use port 8888 because there is nothing setup to listen on that port, and it's blocked. You should set it to port 80 in your code. The URL is where your web service is stored at (e.g. http://mysite.com/mywcfservice.svc, http://mysite.com/mywebservice.asmx)
     
    mjp likes this.
  6. Actually my web service is really the node js program. If I want to execute mywebservice.js, how do I enter information in the URL to indicate which node program I wish to execute. On my local server I assign a certain port (ie, 8888) in my node program and then include that port in my url. So if I set my port to 80 for all my js programs, how does the url know which node program to execute? Is it as simple as entering http://mysite.com/mywebservice.js?
     
  7. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    I've never written anything in node.js, so I can't confirm how it works. I suggest you try it out.
     
    mjp likes this.
  8. It doesn't sound like anyone knows how to put everything together to run a node js application on discountasp. I guess it is going to be trial and error. I would think discountasp would research this better and provide its clients with an easy example or a procedure to run a node application. The blog referencing node js is incomplete. All it does it tell you how to specify the node program(s). It doesn't tell you how to access them or run them. Thank you for your help.
     

Share This Page