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-driven, asynchronous 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 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.[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/');
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);
0 komentar:
Dengan mengirim komentar disini, Anda menyetujui bahwa komentar anda tidak mengandung Rasis ataupun konten pornografi