Node.js
This article has an unclear citation style. The reason given is: Violates Wikipedia:External links: "Wikipedia articles may include links to web pages outside Wikipedia (external links), but they should not normally be used in the body of an article." (March 2014) |
Original author(s) | Ryan Lienhart Dahl |
---|---|
Developer(s) | Node.js Developers, Joyent, Github Contributors |
Initial release | May 27, 2009[1] |
Stable release | 0.10.28
/ May 1, 2014[2] |
Preview release | 0.11.12
/ March 11, 2014[3] |
Repository | |
Written in | C, C++, JavaScript |
Operating system | Mac OS X, Linux, Solaris, FreeBSD, OpenBSD, Windows (older versions require Cygwin), webOS |
Type | Event-driven networking |
License | MIT |
Website | nodejs |
Node.js is a software platform for scalable server-side and networking applications. Node.js applications are written in JavaScript, and can be run within the Node.js runtime on Mac OS X, Windows and Linux with no changes.
Node.js applications are designed to maximize throughput and efficiency, using non-blocking I/O and asynchronous events. Node.js applications run single-threaded, although Node.js uses multiple threads for file and network events. Node.js is commonly used for real time applications due to its asynchronous nature.
Node.js internally uses the Google V8 JavaScript engine to execute code, and a large percentage of the basic modules are written in JavaScript. Node.js contains a built-in asynchronous i/o library for file, socket and HTTP communication. The HTTP and socket support allows Node.js to act as a web server without additional web server software such as Apache.
Overview
Ryan Dahl, the creator of Node.js, originally had the goal in mind of creating 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.[4]
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, JavaScript, Groovy, Python and Ruby; Akka for Java and Scala; EventMachine for Ruby and vibe.d for D. Unlike most JavaScript programs, Node.js is not executed in a web browser, but instead as a server-side JavaScript application. Node.js implements some CommonJS specifications.[5] It also provides a REPL environment for interactive testing.
Architecture
There are four building blocks that constitute Node.js. First, Node.js encapsulates libuv to handle asynchronous events and Google’s V8 to provide a run-time for JavaScript. Libuv is what abstracts away all of the underlying network and file system functionality on both Windows and POSIX-based systems like Linux, Mac OS X and Unix. The core functionality of Node.js, modules like Assert, HTTP, Crypto, etc., reside in a core library written in JavaScript. The Node.js bindings, written in C++, provide the glue connecting these technologies to each other and to the operating system.
Community
Node.js has a developer community primarily centered on two mailing lists, nodejs,[6] nodejs-dev,[7] and the IRC channel #node.js on freenode. The community gathers at NodeConf,[8] an annual developer conference focused on Node.js.[9]
Node.js is currently used by a number of large companies including Groupon,[10] SAP,[11]LinkedIn,[12][13] Microsoft,[14][15] Yahoo!,[16] Walmart[17] and PayPal.[18]
History
Inspiration
Node.js was created by Ryan Dahl starting in 2009. Its development and maintenance is sponsored by Joyent.[19] Dahl was inspired to create Node.js after seeing a file upload progress bar on Flickr. The browser did not know how much of the file had been uploaded and had to query the web server. Dahl wanted an easier way.[20] Ruby's Mongrel web server was another source of inspiration for Dahl.[21]
Originally Dahl had several failed projects in C, Lua, and Haskell, but when Google's V8 engine was released, Dahl began to examine JavaScript.[22]
Even though his original idea was non-blocking, he "backed out of that (a bit) in the module system and a few other areas," as it made loading external libraries troublesome.[23]
Versions
Node.js was first published by Dahl in 2011 and could only run on Linux. npm, a package manager for Node.js libraries, was introduced the same year.
In June 2011, Microsoft partnered with Joyent to help create a native Windows version of Node.js.[24] The first Node.js build to support Windows was released in July.
Recent events
On January 30, 2012 Dahl stepped aside, promoting coworker and npm creator Isaac Schlueter to the gatekeeper position. Dahl wrote on Google groups,
Now that the rewrite on top of libuv is largely complete, I am ceding my position as gatekeeper to Isaac Schlueter. Our energy will now be largely focused over the next few months on improving the third party module system experience including a website for browsing modules, a new addon build system, and binary installations from npm. Isaac is in the unique position to bridge the gap between core and external modules to ensure a pleasant experience. After three years of working on Node, this frees me up to work on research projects. I am still an employee at Joyent and will advise from the sidelines but I won't be involved in the day-to-day bug fixes. Isaac has final say over what makes it into the releases. Appeals for new features, changes, and bug fixes should now be directed at him.[25]
Dahl continues to work for Joyent and as an advisor for Node.js.[26]
On January 15, 2014 Schlueter announced he was making npm his main focus and Timothy J Fontaine would be Node.js' new project lead. Isaac wrote on the Node.js blog,
Over the last year, TJ Fontaine has become absolutely essential to the Node.js project. He's been building releases, managing the test bots, fixing nasty bugs and making decisions for the project with constant focus on the needs of our users. ... Anyone who's been close to the core project knows that he's been effectively leading the project for a while now, so we're making it official. Effective immediately, TJ Fontaine is the Node.js project lead. I will remain a Node.js core committer, and expect to continue to contribute to the project in that role. My primary focus, however, will be npm.[27]
The next day, January 16, 2014, Timothy J Fontaine made a followup post outlining the road ahead where he, among other things, mention bug fixing, performance tuning, staying up to date with V8 engine and tooling.[28]
Tools and IDEs
IDEs (editor, debugger, linter)
- JetBrains WebStorm (commercial)
- JetBrains IntelliJ IDEA (commercial)
- Nodeclipse Enide Studio (free open-source, Eclipse-based)
- Microsoft Visual Studio with TypeScript
Online code editors
- Codenvy IDE (cloud service)
- Codio (cloud service)
- Cloud9 IDE (cloud service)
Runtimes and debuggers
- Microsoft WebMatrix (free) or Visual Studio (commercial product) with Node.js Tools for Visual Studio (free)
- Node Inspector debugger (Debugger Interface using Google's Blink Developer Tools)
Examples
This is an implementation of a "hello world" 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);
See also
References
- ^ https://github.com/joyent/node/tags?after=v0.0.4
- ^ [1]
- ^ [2]
- ^ 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
- ^ http://groups.google.com/group/nodejs
- ^ http://groups.google.com/group/nodejs-dev nodejs-dev
- ^ http://www.nodeconf.com/
- ^ NodeConf Schedule Announced, By Klint Finley, April 7, 2011, ReadWriteHack
- ^ Geitgey, Adam (30 October 2013). "I-Tier: Dismantling the Monoliths". Groupon. Retrieved 30 April 2014.
- ^ "SAP AppBuilder". SAP. March 10, 2014. Retrieved March 10, 2014.
- ^ "You'll never believe how LinkedIn built its new iPad app". VentureBeat. May 2, 2012. Retrieved May 10, 2012.
- ^ [3], 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.
- ^ [4], WebMatrix - Front End Web Developers take note (ASP.NET, PHP, node.js and more)
- ^ [5], Yahoo! Developer Network announces Cocktails project using Node.js
- ^ "Why Walmart is using Node.js". VentureBeat. January 24, 2012. Retrieved May 10, 2012.
- ^ "Clash of the Titans: Releasing the Kraken, NodeJS @paypal". fluentconf.com. May 28, 2013. Retrieved September 11, 2013.
- ^ Alex Handy (2011-06-24). "Node.js pushes JavaScript to the server-side". SDTimes. Retrieved 2011-09-04.
- ^ Harris, Amber (April 1, 2012). "The Birth of Node: Where Did it Come From? Creator Ryan Dahl Shares the History". Devops Angle. Retrieved 26 October 2013.
- ^ Synodinos, Dio (December 13, 2010). "Deep inside Node.js with Ryan Dahl". InfoQ. Retrieved 26 October 2013.
- ^ McCarthy, Kevin (January 31, 2011). "Node.js Interview: 4 Questions with Creator Ryan Dahl". Streetwise Media. Retrieved 26 October 2013.
- ^ Podsechin, Oleg (August 10, 2010). "Ryan Dahl Interview: Part 1". DailyJS. Retrieved 26 October 2013.
- ^ [Porting Node to Windows http://blog.nodejs.org/2011/06/23/porting-node-to-windows-with-microsoft%25e2%2580%2599s-help/], Node.js Blog
- ^ Dahl, Ryan. "New gatekeeper". Retrieved 26 October 2013.
- ^ Finley, Klint (January 30, 2012). "Node.js Creator Ryan Dahl Cedes Role as Gatekeeper to NPM Creator Isaac Schlueter". Silicon Angle. Retrieved 26 October 2013.
- ^ Schlueter, Isaac (January 15, 2014). "The Next Phase of Node.js". Retrieved 21 January 2014.
- ^ Fontaine, Timothy (January 16, 2014). "Node.js and the Road Ahead". Retrieved 21 January 2014.
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
- 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=
- Ribeiro Pereira, Caio (July 2013), Aplicações web real-time com Node.js (First ed.), Casa do Código, p. 143, ISBN 978-85-66250-14-5
External links
- Official website
- npm - the official package manager for Node.js
- nodejs modules
- Node.js Tools for Visual Studio
- JXcore - Multi-threaded fork on Node.js