I have downloaded Node.js from their site in my windows xp os. I have installed it through the microsoft installer. I didn’t know how to write my first application, where to save them and how to execute them in Windows. I have got a node.js command prompt but I can’t use it.
I have searched a lot but there is only instruction for linux and mac. I didn’t find any suitable tutorial or example that I can start a node application from scratch.
If anybody can put some documentation or steps or any such tutorial where I can get help of this, it will be great for me.
As this blog entry by Eric, it is ridiculously easy to get a node.js server setup and responding to requests on
127.0.0.1:#port#.Really easy. I just did it all in… Longer than write this text.
Download an OS-appropriate node.js1: http://nodejs.org/
Now, create a
.txt(plaintext) file in the same folder as yournode.exeand rename that toserver.js.Put this Javascript in that file:
Open a
cmd.exeandcd c:\path\to\the\node\executable, wherenode.exeresides.From there, run:
You should see it say:
Open a browser and put
http://127.0.0.1:8125/in the address bar.You should see it say:
That’s it. That’s pretty easy. The proverbial
Hello World!in 15 seconds or less. Now how to get it to parse a Javascript file and return that output instead of simple HTML…1. Note, I got the executable,
node.exe, made a folder somewhere, put the executable in that folder. No installer. Works like a charm.