Introduction
What is Node.js ?
Programming Language ?
Framework ?
Software ?
Platform ?
...
else?
Node.js® is a platform built on Chrome's JavaScript runtime (V8) for easily building fast, scalable network applications.
Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications (DIRTy) that run across distributed devices.
Hello World!
console.log("Hello World!");var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(12345);
console.log('Server running at http://127.0.0.1:12345/');var fs = require('fs');
var stream = fs.createReadStream('node_event.png');
stream.on('data', function(chunk){
console.log(chunk);
});
stream.on('end', function(){
console.log('Read Completed!');
});
console.log('881');Learn Node.js (official)