1. What is Node.js
[1]Node is a server-side JavaScript interpreter, but if you really think that students who are good at JavaScript can easily master it by learning Node, then you are wrong. Summary: I don’t know whether the water is deep or not, but it is not. shallow.
[2] The goal of Node is to help programmers build highly scalable applications and write code that can handle tens of thousands of simultaneous connections to a physical machine. Handling high concurrency and asynchronous I/O is one of the reasons why Node attracts developers' attention.
[3] Node itself runs the Google V8 JavaScript engine, so the speed and performance are very good, as you can see by looking at chrome, and while Node encapsulates it, it also improves its ability to process binary data. Therefore, Node not only simply uses V8, but also optimizes it to make it more powerful in various environments.
[4] Third-party extensions and modules play an important role in the use of Node. The following will also introduce downloading npm. npm is a module management tool. Use it to install various Node software packages (such as express, redis, etc.) and publish the software packages you write for Node.
2. node.js installation
[1] For Windows platform, just download and install it
[2] Passed under Linux platform:
wget http://nodejs.org/dist/v0.6.1/node-v0.10.31.tar.gz tar zxvf node-v0.10.31.tar.gz cd node-v0.10.31 ./configure
3. Simple case
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(3000, "127.0.0.1"); console.log('Server running at http://127.0.0.1:3000/');
"Hello World" can be viewed through browser access.