Node.js
![]() | |
原作者 | Ryan Lienhart Dahl |
---|---|
開發者 | Node.js Developers |
当前版本 | 0.4.10(2011年7月19日 | )
预览版本 | 0.5.4(2011年8月12日 | )
源代码库 | |
编程语言 | C++, JavaScript |
操作系统 | Mac OS X, Linux, Solaris, FreeBSD, OpenBSD, Windows (older versions require Cygwin), webOS |
类型 | Event-driven networking |
许可协议 | MIT License |
网站 | http://nodejs.org/ |
![]() |
Node.js is an event-driven I/O server-side JavaScript environment based on V8. It is intended for writing scalable network programs such as web servers.[1] It was created by Ryan Dahl in 2009, and its growth is sponsored by Joyent, which employs Dahl.[2] [3]
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, it is not executed in a web browser, but is instead a form of server-side JavaScript. Node.js implements some CommonJS specifications.[4] Node.js includes a REPL environment for interactive testing.
Examples
HTTP Server version of hello world 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/');
Another example with a simple TCP server which listens on port 7000 and echoes whatever you send it:
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);
Modules
Community
There is a very active Node.js developer community primarily centered on two mailing lists, nodejs and nodejs-dev, and the IRC channel #node.js on freenode. The community gathers at an NodeConf, an annual developer conference focused on Node.js.[5]
See also
- JavaScript
- V8 (JavaScript engine)
- NPM, the Node Package Manager - the predominant package manager for Node.js.
- JSAN, the JavaScript Archive Network - a lesser used JavaScript package manager.
References
- ^ http://www.readwriteweb.com/hack/2011/01/wait-whats-nodejs-good-for-aga.php
- ^ http://mashable.com/2011/03/10/node-js/
- ^ Alex Handy. Node.js pushes JavaScript to the server-side. SDTimes. 2011-06-24 [2011-06-24].
- ^ http://wiki.commonjs.org/wiki/Implementations/node.js
- ^ http://www.readwriteweb.com/hack/2011/04/nodeconf-schedule-announced.php
External links
- 官方网站
- Source Repository
- Nodejs mailing list - general discussion about Node.js
- Nodejs-dev mailing list - list for discussion of bugs and changes to Node.js itself
- The Node.js Package Manager
- How To Node tutorial web site
- How to write your own native Node.js extension
- Node.js contributor Felix Geisendörfer gives some background on Node.js on The Changelog podcast
- A thorough introduction on the PavingWays blog
- Introduction to Node.js
- Node.js and the JavaScript Age
- The Node Beginner Book, a comprehensive introduction for experienced developers that are new to Node.js
![]() | 这是一篇關於電腦程式語言的小作品。您可以通过编辑或修订扩充其内容。 |