Sunday, June 11, 2017

Nodejs

Node Js


  • Node.js is a very powerful JavaScript-based framework
  • It is used to develop I/O intensive web applications like video streaming sites, single page applications, and other web applications.
  • Node.js is an open source, cross-platform runtime environment for developing server side and networking applications.
  • Node.js applications are written in JavaScript, and can be run within the Node.js runtime on OS X, Microsoft Windows, and Linux.


Concepts

⇉ console.log("Hello World!");
O/P Hello World!

  • The files you create with your editor are called source files and contain program source code. The source files for Node.js programs are typically named with the extension ".js".
  •  if you want dwd nodejs server visit this page
https://nodejs.org/download/

var http = require("http");

http.createServer(function (request, response) {

   // Send the HTTP header 
   // HTTP Status: 200 : OK
   // Content Type: text/plain
   response.writeHead(200, {'Content-Type': 'text/plain'});
   
   // Send the response body as "Hello World"
   response.end('Hello World\n');
}).listen(8081);

// Console will print the message
console.log('Server running at http://127.0.0.1:8081/');
Now execute the main.js to start the server as follows −
$ node main.js
Verify the Output. Server has started.
Server running at http://127.0.0.1:8081/
do you want more information visit http://www.tutorialspoint.com/nodejs/

No comments:

Post a Comment