30-minutes with Node.js – P1

I’ve read about Node.js and finally had a chance to test it out. After 30 minutes, I found it easy to use and very powerful, and would definitely explore some more in the future. This blog documents my short experiment with Node.js

Node.js is a runtime as as well as a library. It is based on Google V8 Engine and is what Chrome uses to run JavaScript. Node.js allows one to create back-end app with JavaScript.

1. 00:01:00 Insteall Node.js


2. 00:02:00 Test node at the commandline prompt

Open an terminal and type “node”. If node can not be found, then close all terminals and open a new terminal. Test again. If for some reason it still does not work , then add the path to nodejs (C:\Program Files\nodejs on Windows 8) to your system path

3. 00:03:00 Start reading tutorial for beginner


Create a helloworld.js

console.log("hello World");

At the commandline, change directory to where helloworld.js is and

node helloworld.js

4. 00:30:00 Created a webserver using Node.js

Create a server.js file

var http=require("http")
function start(){
   function onRequest(request, response){
       console.log("Request received");
       response.write("Hello World");
   console.log("Server has started.");
exports.start = start;

Create an index.js file

var server = require("./server");

Then start the server

node index.js


Leave a Reply