First knowledge of Node.js_node.js

Source: Internet
Author: User

1. What is Node.js

[1] node is a server-side JavaScript interpreter, but really think JavaScript good students learn node can easily take off, then you are wrong, summed up: the depth is not deep I do not know, but really not shallow.

[2] Node's goal is to help programmers build highly scalable applications and write connection codes that handle tens of thousands of simultaneous connections to one physical machine. Handling high concurrency and asynchronous I/O is one of the reasons that node is concerned by developers.

[3] Node itself runs Google V8 JavaScript engine, so the speed and performance is very good, see chrome, and node to its encapsulation also improved its ability to process binary data. Therefore, node not only uses V8, but also optimizes it to make it more power in various environments.

[4] third-party extensions and modules play an important role in the use of node. The download NPM,NPM is the management tool for the module, which installs various node packages (such as Express,redis, etc.) and publishes the packages that you write for node.

2, Node.js Installation

[1]windows platform can only download and install

[2]linux under the 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 ({' 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/');


The "Hello World" can be viewed through browser access.

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.