Saturday, February 22, 2014

2/22/2014

2/22/2014

About node.js

These days everybody talks about node.js. Some of them boast about what cool things they did with node.js. Well, I need to catch up with these guys but I don't want to spend too much time learning node.js. So I set out a challenge myself to find out more about node.js in a short period of time.

So I downloaded node.js and all ready to go!

My first experiment with node

  1. On my windows PC, I created a file test.js under C:\node-examples folder
  2. I added the following line in test.js:
  3. console.log("testing node");
  4. From command prompt, I ran the command "node test.js" and "testing node" came up.
  5. C:\node-examples>node test.js
  6. Viola! I was able to run my JavaScript file from command prompt using node.
My second experiment with node
  1. I modified test.js so that now it has the following content:
  2. function printLine(){
           console.log("printing from node");
    }
    console.log(printLine());
  3. From command prompt, I ran the command "node test.js" and "printing from node" came up. Nice!!
  4. C:\node-examples>node test.js
Notes:
There is this site http://code.tutsplus.com/tutorials/nodejs-for-beginners--net-26314 where they have a simple but good tutorial on node.js! I am going to dive into that right away!


No comments:

Post a Comment