[Node. js learning] -- (1) -- HelloWord, node. js -- helloword

Source: Internet
Author: User

[Node. js learning] -- (1) -- HelloWord, node. js -- helloword

Today, I practiced an entry-level case of nodejs, which is very lightweight and fast!


Official Website

Http://nodejs.org/download/

 

Download

Windows 7 64-bit download msi installation package:

Http://nodejs.org/dist/v0.12.0/x64/node-v0.12.0-x64.msi


Install

All the way crazy

Install to drive F: \ nodejs

 

Execute common JS

Create in the installation directory

Hello. js

Console. log ("hello world! ");

Go to the installation directory and execute nodehello. js. The effect is as follows:

 

Start the server to run js

Create http. js

Var http = require ("http"); http. createServer (function (request, response) {response. writeHead (200, {"Content-Type", "text/html"}); response. write ("Hello World! "); Response. end () ;}). listen (8000 );

Run


Enter in the browser

Http: // localhost: 8000/indicates the running effect:


Reference

Http://www.cnblogs.com/jununx/p/3369781.html

Http://nodejs.org/download/

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.