Setup Node.js development environment in Windows

Download nodejs LTS:https://nodejs.org/en/

In windows command line, run:

1
node

To exit:

1
process.exit()

First script to run a server:

1
2
3
4
5
6
7
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200,{'Content-Type': 'text/plain'});
res.end('Hello World!\n');
}).listen(8000, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8000/');

Install Express:

1
2
npm install -g express
npm install -g express-generator

Check npm and their locations:

1
npm list -g

Create Express demo application:

1
2
3
4
5
express demo
cd demo
npm install
SET DEBUG=demo:* & npm start
Share