node. JS Beginner

Source: Internet
Author: User

I. Installation and Environment configuration:

The two articles are very detailed.

Http://www.cnblogs.com/seanlv/archive/2011/11/22/2258716.html

Http://www.tuicool.com/articles/UJNb2eJ

Two. Test case (Chinese garbled problem has been solved)

var http = require ("http");
Http.createserver (function (request, response) {
Response.writehead ($, {"Content-type": "Text/plain;charset=utf-8"});
Response.Write ("node is running, Test here");
Response.End ();
}). Listen (8899);
Console.log ("node is running, listening on port 8899!");

Which solves garbled problem need to pay attention to two points:

(1) JS file Set code

Response.writehead ($, {"Content-type": "Text/plain;charset=utf-8"});

(2) Change JS file encoding format to Utf-8

You can open the JS file by Notepad, select "File"-"Save as" to see if the encoding format is utf-8, and if not, store it after modification.

node. JS Beginner

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.