Node.js
This article's lead section may not adequately summarize key points of its contents. (October 2012) |
Original author(s) | Ryan Lienhart Dahl |
---|---|
Developer(s) | Node.js Developers, Joyent |
Stable release | 0.8.18 / January 18, 2013 |
Preview release | 0.9.8 / January 24, 2013 |
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 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]
Contents |
[edit] 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 growth 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 Twisted for Python, Perl Object Environment for Perl, libevent for C, Vert.x for Java and EventMachine for Ruby. 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 provides a REPL environment for interactive testing.
[edit] 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 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);
[edit] Community
Node.js has a developer community primarily centered around 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] Yahoo![11] and Walmart.[12]
[edit] 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
[edit] 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. http://www.theregister.co.uk/2011/03/01/the_rise_and_rise_of_node_dot_js/.
- ^ 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. http://www.sdtimes.com/NODE_JS_PUSHES_JAVASCRIPT_TO_THE_SERVER_SIDE/By_Alex_Handy/About_JAVASCRIPT_and_NODEJS/35668. 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. http://venturebeat.com/2012/05/02/linkedin-ipad-app-engineering/. 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. http://www.guardian.co.uk/technology/blog/2011/nov/09/programming-microsoft. Retrieved May 10, 2012.
- ^ [2], Yahoo! Developer Network announces Cocktails project using Node.js
- ^ "Why Walmart is using Node.js". VentureBeat. January 24, 2012. http://venturebeat.com/2012/01/24/why-walmart-is-using-node-js/. Retrieved May 10, 2012.
[edit] 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
- Ornbo, George (September, 2012), Sams Teach Yourself Node.js in 24 Hours (First ed.), SAMS Publishing, p. 440, ISBN 978-0-672-33595-2
- Teixeira, Pedro (October, 2012), Professional Node.js (First ed.), John Wiley & Sons, p. 408, ISBN 978-1-1182-2754-1, http://eu.wiley.com/WileyCDA/WileyTitle/productCd-1118185463,descCd-authorInfo.html
- 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. http://twit.tv/show/floss-weekly/237. Retrieved 9 January 2013.