Node.js

Node.js is a server-side platform for the operation of network applications. In particular web server can be realized with it. Node.js is based on the JavaScript runtime environment " V8", which was originally developed for the Chrome browser, and provides a resource-saving architecture that allows a very large number of concurrent network connections.

Architecture

JavaScript is before an event driven architecture, which has the advantage in server mode, per a conversation to consume less memory than comparable applications that start a separate thread for each open connection.

Modules

Node.js contains some modules that are compiled directly into the binary package. In addition to the module for asynchronous network access also includes adapters for the file system, buffer, timer, and of a general data stream class.

Furthermore, additional modules can be integrated, for example via precompiled files with the file extension. Node or in the form of simple JavaScript files. The JavaScript modules follow the CommonJS Convention, a standard for JavaScript - systems that are operated outside of browsers, and thus represent a variable named exports forth on access functions and variables of the corresponding module.

To manage the modules there is the package manager npm, in whose custody are over 48,000 packages. This ensures, in consideration of dependencies for installing, updating and compiling binary modules.

Examples

Var http = require ( 'http ');   http.createServer (function ( req, res ) {    res.writeHead (200, {      'Content -Type': 'text / html'    });    res.write ( 'Hello World' );    res.end (); }) list (3000). ; As another example, a simple TCP server on port 7000 receives data and responds with "Hello" and then still returns all the received data to the client:

Var net = require ( 'net '),      endOfLine = require ( ' os ') EOL. ;   var server = net.createServer (function ( socket ) {    socket.setEncoding ( ' utf8 ');      socket.write ( ' Hello ' endOfLine );      socket.pipe (socket, {      end: false    });      socket.on ( 'end', function () {      socket.end ( ' Goodbye ' endOfLine );    }); });   server.listen ( 7000, 'localhost '); projects

A list of selected projects based on Node.js:

  • EtherPad Lite
  • PDFKit
  • Kod, editor for Mac OS X
  • WebOS HP
  • StackVM, it browser- ling ( cross-browser testing in the browser) based
  • NodeBB, a real-time Internet forum software
  • Ghost, a blog software

Awards

  • In July 2011, Node.js developer Ryan Dahl was awarded at the conference OSCON one of the O'Reilly Open Source Awards.
  • InfoWorld has Node.js awarded in August 2011 with the Bossie Award for Best Open - source software in the " Developer Tools ".
606762
de