Node.js - Wikipedia
Type Event-driven networking
Node.js is a software platform that is used to build scalable network (especially server-side) applications. Node.js utilizes JavaScript as its scripting language, and achieves high throughput via non-blocking I/O and a single-threaded event loop.
Node.js contains a built-in HTTP server library, making it possible to run a web server without the use of external software, such as Apache or Lighttpd, and allowing more control of how the web server works.
Node.js was created by Ryan Dahl starting in 2009. Its development and maintenance is sponsored by Joyent.[4] 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 uploaded and had to query the web server. Dahl wanted an easier way.[5] Ruby's Mongrel web server was another source of inspiration for Dahl.[6] Originally Dahl had several failed projects in C, Lua, and Haskell, but when Google's V8 engine was released, Dahl began to examine JavaScript.[7] 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.[8]
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.[9]
Dahl continues to work for Joyent and as an advisor for node.[10]
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 core committer, and expect to continue to contribute to the project in that role. My primary focus, however, will be npm.[11]
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.[12]
Overview
Node.js is a packaged compilation of Google's V8 JavaScript engine, the platform abstraction layer, and a core library, which is itself primarily written in JavaScript.
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.[13]
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.[14] It also provides a REPL environment for interactive testing.
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);
Tools and IDEs
Cloud9 IDE (cloud service)
JetBrains WebStorm or IntelliJ IDEA (commercial products)
Microsoft WebMatrix (free) or Visual Studio (commercial product) with Node.js Tools for Visual Studio (free)
Nodeclipse (Eclipse-based)
Community
Node.js has a developer community primarily centered on two mailing lists, nodejs,[15] nodejs-dev,[16] and the IRC channel #node.js on freenode. The community gathers at NodeConf,[17] an annual developer conference focused on Node.js.[18]
Node.js is currently used by a number of large companies including LinkedIn,[19][20]Microsoft,[21][22] Yahoo!,[23] Walmart[24] and PayPal.[25]
.END
No comments:
Post a Comment