Deploy and install nodejs in Windows)

Source: Internet
Author: User

Nodejs, as a new background language, has many attractive points:

  1. Restful API
  2. Single thread
  3. Non-blocking Io
  4. Google V8
  5. Event-driven

The processing model of node is different from the concurrency model of commonly used operating system threads. The thread-based network is relatively inefficient and hard to use. Apply for 2 m for each new connection with the traditional thread model
Compared to the thread stack, node shows better memory efficiency under high load. In addition, the node user does not have to worry about the process deadlock, because there is no lock concept in node. Almost no direct Node
The process will never block the function that executes Io operations, because there is no blocking, even if it is not an expert, you can write a quick system.

Node is designed with Ruby event
The twisted effects of machine and Python are similar to those of them. Node pays more attention to the event model. It uses the event loop as the language structure rather than the class library. In other systems
There will be a blocking call to start the event loop. At the beginning of the script, use the callback function to define an action, and then call the blocked call (for example
Eventmachine: Run () to start the service. Node does not have such a function call to start the event loop. It automatically enters the event loop after executing the input script, which is a bit like a browser
The event loop is hidden from the user.

Install and deploy nodejs on Linux. The related documents are complete and the entire process is relatively simple. However, to deploy nodejs on Windows, you have to work hard before. Now, it's okay, with official support, everything becomes simple:

First: download this nodejs EXE file: http://nodejs.org/dist/v0.5.2/node.exe (currently still unstable Version)

Next, enter the file directory of node.exe and create a new HELLO. js file. The content is as follows:

var http = require('http');
http.createServer(function(req, res) {
res.writeHead(200, {
'Content-Type': 'text/plain'
});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');

Then, open the logging command line and enter the directory of node.exe. then, you can add node.exe to the system path, so that you can execute it anywhere and execute the file above.

Node hello. js

At this time, we can see:

Open your browser:

Well, everything is ready. You can start!

Reprinted Please note:
Author: Beiyuu
Address: deploy and install nodejs in Windows

Nodejs, as a new background language, has many attractive points:

  1. Restful API
  2. Single thread
  3. Non-blocking Io
  4. Google V8
  5. Event-driven

The processing model of node is different from the concurrency model of commonly used operating system threads. The thread-based network is relatively inefficient and hard to use. Apply for 2 m for each new connection with the traditional thread model
Compared to the thread stack, node shows better memory efficiency under high load. In addition, the node user does not have to worry about the process deadlock, because there is no lock concept in node. Almost no direct Node
The process will never block the function that executes Io operations, because there is no blocking, even if it is not an expert, you can write a quick system.

Node is designed with Ruby event
The twisted effects of machine and Python are similar to those of them. Node pays more attention to the event model. It uses the event loop as the language structure rather than the class library. In other systems
There will be a blocking call to start the event loop. At the beginning of the script, use the callback function to define an action, and then call the blocked call (for example
Eventmachine: Run () to start the service. Node does not have such a function call to start the event loop. It automatically enters the event loop after executing the input script, which is a bit like a browser
The event loop is hidden from the user.

Install and deploy nodejs on Linux. The related documents are complete and the entire process is relatively simple. However, to deploy nodejs on Windows, you have to work hard before. Now, it's okay, with official support, everything becomes simple:

First: download this nodejs EXE file: http://nodejs.org/dist/v0.5.2/node.exe (currently still unstable Version)

Next, enter the file directory of node.exe and create a new HELLO. js file. The content is as follows:

var http = require('http');
http.createServer(function(req, res) {
res.writeHead(200, {
'Content-Type': 'text/plain'
});
res.end('Hello World\n');
}).listen(1337, "127.0.0.1");
console.log('Server running at http://127.0.0.1:1337/');

Then, open the logging command line and enter the directory of node.exe. then, you can add node.exe to the system path, so that you can execute it anywhere and execute the file above.

Node hello. js

At this time, we can see:

Open your browser:

Well, everything is ready. You can start!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.