Node.js
Node.js Logo | |
Original author(s) | Ryan Lienhart Dahl |
---|---|
Developer(s) | Node.js Developers, Joyent |
Stable release | 0.10.5
/ April 23, 2013 |
Preview release | 0.11.1
/ April 19, 2013 |
Repository | |
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 |
Node.js is a server-side software system designed for writing scalable Internet applications, notably web servers.[1] Programs are written on the server side in JavaScript, using event-driven, asynchronous I/O to minimize overhead and maximize scalability.[2]
Node.js creates a web server by itself, making it unnecessary to use web server software such as Apache or Lighttpd and allowing full control of how the web server actually works. Node.js enables web developers to create an entire web application on both server-side and client-side in one language (JavaScript).
Details
Node.js is a packaged compilation of Google's V8 JavaScript engine, the libuv platform abstraction layer, and a core library, which is itself primarily written in JavaScript.
Node.js was created by Ryan Dahl starting in 2009, and its development and maintenance is sponsored by Joyent, his former employer.[3][4]
Dahl's original goal was to create web sites with push capabilities as seen in web applications like Gmail. After trying solutions in several other programming languages he chose JavaScript because of the lack of an existing I/O API. This allowed him to define a convention of non-blocking, event-driven I/O.[5]
Similar environments written in other programming languages include Tornado and Twisted for Python, Perl Object Environment for Perl, libevent for C, Vert.x for Java, Akka for Java and Scala, EventMachine for Ruby and vibe.d for D. Unlike most JavaScript programs, it is not executed in a web browser, but instead as a server-side JavaScript application. Node.js implements some CommonJS specifications.[6] It also provides a REPL environment for interactive testing.
Examples
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://localhost:8000/');
The following code is a simple TCP server which listens on port 8000 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(8000);
Tools and IDEs
- CloudIDE c9.io (cloud service)
- JetBrains WebStorm or IntelliJ IDEA (commercial products)
- Microsoft WebMatrix (free) or Visual Studio (commercial product)
- Netbeans has a NodeJS plugin
- Nodeclipse (Nodeclipse-1 Eclipse plugin, Eclipse Node.js IDE aka Enide)
Community
Node.js has a 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.[7]
Node.js is currently used by a number of large companies including LinkedIn,[8][9] Microsoft,[10][11] Yahoo![12] and Walmart.[13]
See also
- npm – the predominant package manager for Node.js. As of Node.js version 0.6.3, npm is installed automatically with Node.js
References
- ^ Wait, What's Node.js Good for Again?, By Klint Finley, January 25, 2011, ReadWriteHack
- ^ Cade Metz (1 March 2011). "The Node Ahead: JavaScript leaps from browser into future". The Register.
{{cite news}}
: Italic or bold markup not allowed in:|publisher=
(help) - ^ Why Everyone Is Talking About Node, By Jolie O'Dell, March 10, 2011, Mashable
- ^ Alex Handy (2011-06-24). "Node.js pushes JavaScript to the server-side". SDTimes. Retrieved 2011-09-04.
- ^ Hughes-Croucher, Tom; Wilson, Mike (2012). Up and Running with Node.js. Up and Running (1st ed.). Sebastopol: O'Reilly. p. vii. ISBN 978-1-4493-9858-3.
I was concerned about the ability to program advanced push features into the website like I had seen in Gmail
See the book's Foreword at OReilly.com - ^ Implementations/node.js - CommonJS Spec Wiki
- ^ NodeConf Schedule Announced, By Klint Finley, April 7, 2011, ReadWriteHack
- ^ "You'll never believe how LinkedIn built its new iPad app". VentureBeat. May 2, 2012. Retrieved May 10, 2012.
- ^ [1], LinkedIn's developer blog discusses their Node.js stack optimizations
- ^ "Here's why you should be happy that Microsoft is embracing Node.js". The Guardian. November 9, 2011. Retrieved May 10, 2012.
- ^ [2], WebMatrix - Front End Web Developers take note (ASP.NET, PHP, node.js and more)
- ^ [3], Yahoo! Developer Network announces Cocktails project using Node.js
- ^ "Why Walmart is using Node.js". VentureBeat. January 24, 2012. Retrieved May 10, 2012.
Further reading
- Hughes-Croucher, Tom; Wilson, Mike (April, 2012), Up and Running with Node.js (First ed.), O'Reilly Media, p. 204, ISBN 978-1-4493-9858-3
{{citation}}
: Check date values in:|date=
(help) - Ornbo, George (September, 2012), Sams Teach Yourself Node.js in 24 Hours (First ed.), SAMS Publishing, p. 440, ISBN 978-0-672-33595-2
{{citation}}
: Check date values in:|date=
(help) - Teixeira, Pedro (October, 2012), Professional Node.js (First ed.), John Wiley & Sons, p. 408, ISBN 978-1-1182-2754-1
{{citation}}
: Check date values in:|date=
(help) - Randal L. Schwartz and Aaron Newcomb (9 January 2013). "Episode 237: Node.js". http://twit.tv/show/floss-weekly (Podcast). TWiT.tv. Event occurs at 1:08:13. Retrieved 9 January 2013.
{{cite podcast}}
: External link in
(help)|website=