Tuesday, January 24, 2012

NodeJS : Get Starting With NodeJS on Windows Xp For Newbie

 NodeJS : Get Starting With NodeJS on Windows Xp For Newbie

1. Download Node server from http://nodejs.org/  



2. Once the installation is completed, the folder structure looks like as follows and installation path  in my system is "C:\Program Files\nodejs"






3. To write Your first "Hello World" program, create a folder namely "node_builds" within "C:\Program Files\nodejs". Let’s use this folder like "www in Wamp server" or "htdocs in Xampp Server". Of course,  NodeJs allow us to keep Your project anywhere in local system, always keep right folder structure would be better.



4. Now create a project folder namely "helloworld_proj". And then create a javascript file namely "index.js" within Your project folder and write following code in it. 


5. To run your "Hello World" program, go to DOS-command prompt and then set the base path of command prompt to your project folder by typing the command >cd "C:\Program Files\nodejs\node_builds\helloworld_proj". Now your command prompt would be



6. Now start node server by typing the command >node index.js . And then you gets log message which shows in above piece of code. 



7. Now your server is running. Then go to browser and type the url  "http://127.0.0.1:1337/" which is currently listening by our node server. Now your browser says "Hello World"


Note: Please leave your queries and suggestion as comment.

12 comments:

  1. Thank you, deeply appreciated, worked first time

    ReplyDelete
  2. the above steps are not working for me, Could you please help me out on this:

    the following is the error:

    C:\Program Files\nodejs\node_builds\elloworld_proj>node Index.js
    Server running at http://127.0.0.1:1337/

    events.js:66
    throw arguments[1]; // Unhandled 'error' event
    ^
    Error: listen EADDRINUSE
    at errnoException (net.js:782:11)
    at Server._listen2 (net.js:921:14)
    at listen (net.js:948:10)
    at Server.listen (net.js:1006:9)
    at dns.js:71:18
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

    ReplyDelete
    Replies
    1. Hi friend,
      This is normal. Your port(1337) might be used by some other process. So change your port number in listen(<Port Number Here>, "127.0.0.1") function and try again.

      Great thanks to shared your question.

      Delete
  3. great effort and easy example.
    thanks buddy keep it up

    ReplyDelete
  4. g8 nice ! thank good work easy and simple !

    ReplyDelete
  5. Nice tutorial to start

    ReplyDelete
  6. thank you.. worked perfectly :)

    ReplyDelete
  7. Hey, Wow Provided Post will be Very much Informative to the People Who Visit this Site. Good Work! Thank You for Sharing.
    Joomla training in chennai

    ReplyDelete
  8. Not the style but rather type. Sort is characterized as material used to make the windows which are normally wood, metal or vinyl and is either a substitution or prime window. cost of solar

    ReplyDelete
  9. Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!
    Web Design Training

    ReplyDelete
  10. What material is directly for your new house windows? Numerous individuals swear by PVC, as UPVC windows establish a decent connection and spruce up your home. windows xp iso download

    ReplyDelete