What is node. js?
The answer from the node. js group cited by Douban.com:
Bind the event-driven Io Library to the general programming environment implemented by the V8 JavaScript virtual machine.
Version 0.4.0 released in February 10 has become a new stable branch and has been updated to version 0.4.12.
The unstable branch is added to Native Windows support and has been updated to 0.5.6.
Official website, including API documentation, mail list and so on: http://nodejs.org
Project address: https://github.com/joyent/node
What's the difference?
* Network communication and file system Io are not congested to avoid wasting CPU time.
* Single thread,ProgramThe model is simple. multi-process rather than multi-thread is recommended for multi-core parallel computing.
* The new ecosystem is not as difficult as eventmachine/tornado to integrate Ruby/Python's old modules that insist on synchronous I/O.
* Using V8, a JS engine that puts execution efficiency first and is very active in development.
* Web developers can use the same language on the client and server to reduce the headache caused by Environment switching.
Install
To be honest, the installation is indeed time-consuming and error-prone. I will not introduce the installation method here. Here is a tutorial address:
Http://www.11gz.com/blog/2011/06/22/windows-nodejs-configuration/ (steps are more detailed, I am referring to the tutorial ).
Note that,When installing cygwin, try to install all packages at one time and install them all at once. Otherwise, the subsequent steps may fail. At the same time, because it is downloaded and installed online, it is said that the image site in Japan will be faster (that is, the URL contains the JP suffix ).
Provide a reference Tutorial: http://blog.miniasp.com/post/2011/02/03/Getting-Started-with-NodeJS-on-Windows-using-Cygwin.aspx
Test
In the cygwin installation directory, create a new JS file named test. js and enter:
VaR HTTP = require ('HTTP '); // obtain HTTP modules </P> <p> // build the server <br/> HTTP. createserver (function (request, response) {<br/> // Response Header <br/> response. writehead (200, {'content-type': 'text/html'}); <br/> // response content <br/> response. end ('<B> Hello World cygwin </B>'); <br/> }). listen (8124); // listener port <br/> // console print <br/> console. log ('server running at http: // 127.0.0.1: 8124 /');
Enter node/test. js in the cygwin command window and press Enter.
The command window shows server running at http: // 127.0.0.1: 8124/
Open the browser and enter http: // 127.0.0.1: 8888/to display the content.
Nodejs help document. Upload it later!