Original author(s) | Ryan Lienhart Dahl |
---|---|
Developer(s) | Node.js Developers |
Stable release | 0.6.6 / December 15, 2011 |
Preview release | 0.5.10 / October 21, 2011 |
Development status | Active |
Written in | C++, JavaScript |
Operating system | Mac OS X, Linux, Solaris, FreeBSD, OpenBSD, Windows (older versions require Cygwin), webOS |
Type | Event-driven networking |
License | MIT License |
Website | nodejs.org |
Node.js is a software system designed for writing highly-scalable internet applications, notably web servers.[1] Programs are written in JavaScript, using event-driven, asynchronous I/O to minimize overhead and maximize scalability.[2] Node.js consists of Google's V8 JavaScript engine plus several built-in libraries.
Node.js was created by Ryan Dahl starting in 2009, and its growth is sponsored by Joyent, his employer.[3][4]
Similar environments written in other programming languages include Twisted for Python, Perl Object Environment for Perl, libevent for C and EventMachine for Ruby. Unlike most JavaScript programs, it is not executed in a web browser, but is instead a server-side JavaScript application. Node.js implements some CommonJS specifications.[5] It provides a REPL environment for interactive testing.
Contents |
This is a complete implementation of hello world as an HTTP Server in Node.js:
var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': 'text/plain'}); response.end('Hello World\n'); }).listen(8000); console.log('Server running at http://127.0.0.1:8000/');
This is a simple TCP server which listens on port 7000 and echoes 'hello' upon connection:
var net = require('net'); net.createServer(function (stream) { stream.write('hello\r\n'); stream.on('end', function () { stream.end('goodbye\r\n'); }); stream.pipe(stream); }).listen(7000);
Node.js has an active developer community primarily centered on two mailing lists, nodejs and nodejs-dev, and the IRC channel #node.js on freenode. The community gathers at NodeConf, an annual developer conference focused on Node.js.[6]