Node.js


From Wikipedia, the free encyclopedia
  (Redirected from Nodejs)

Node.js is a software system designed for writing highly-scalable internet applications, notably web servers.[1] Programs are written inJavaScript, using event-drivenasynchronous I/O to minimize overhead and maximize scalability.[2] Node.js consists of Google's V8 JavaScript engine plus several built-in libraries.
Node.js was created by Ryan Dahl starting in 2009, and its growth is sponsored by Joyent, his employer.[3][4]
Similar environments written in other programming languages include Twisted for PythonPerl Object Environment for Perllibevent 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.[5] Unlike most JavaScript systems, it provides a REPL environment for interactive testing.

Examples

This is a complete implementation of hello world as a 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://127.0.0.1:8000/');

This 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 active developer community primarily centered on two mailing lists, nodejs and nodejs-dev, and the IRC channel #node.js on freenode. The community gathers atNodeConf, an annual developer conference focused on Node.js.[6]

0 komentar:

Dengan mengirim komentar disini, Anda menyetujui bahwa komentar anda tidak mengandung Rasis ataupun konten pornografi