Node.js - JavaScript runtime Plateform

Node.jsĀ® is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.

This simple web server written in Node responds with "Hello World" for every request.

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(8080, '127.0.0.1');
console.log('Server running at http://127.0.0.1:8080/');

To run the server, put the code into a file start_web.js and execute it with the node program from the command line:


% node example.js

Server running at http://127.0.0.1:8080/

Node.js

Running npm install from a standard Windows command prompt may fail on deeply nested node_modules hierarchies.

The following is a work around solution:

Copy ..\UI\node_modules to C:\UI\node_modules\ because this shortens the folder path. run npm comand inside the C:\UI folder to install modules for whatever you need and then cut and paste the folder back.


npm install -g grunt-cli

//- Optional
//- npm install -browser-sync

//- Install node_modules
npm install

//- Start a Web Server
grunt server