Wednesday, November 18, 2015

1 - install node.js and create a Hello World program

Install node.js

Go to DOS command prompt

create a directory:  md nodejs
change to directory: cd nodejs
install express: npm install --save express
create a file: app.js

Contents of app.js
==============

var express = require('express');
var app = express();

app.get('/', function(request, response){
    response.send("<h1>Hello Shahadat!</h1>How are you?");
});

app.listen(3000);
console.log("Listening to port: 3000");

======================


Type at the command prompt: node app.js




Open your favorite browser, type the URL : http://localhost:3000



 

No comments:

Post a Comment