Widows node. JS Environment Construction and Operation JS

Source: Internet
Author: User

Yesterday just started learning node. js, some tutorials on the web are not very clear, so summarize my experience.

1. Install.

Installation is omitted, go to the official website to download install a bit just fine. After the installation is complete, open cmd and enter "path" to see if node. js and NPM are configured in the PATH environment. Shown below, indicating that it has been configured.

Check the node. js version, enter "Node--version" or "node-v"

2. Install the module.

NPM is the package management tool that is installed with node. js. It was installed at the same time that node. JS was installed.

Check the node. JS version and enter "NPM--version" or "npm-v":

To install the module, enter:

NPM Install Coffee-script-g

NPM Install Jade-g

NPM Install Mysql-g

CMD shows that when the installation is complete, you can open the NPM catalog C:\Users\momo\AppData\Roaming\npm\node_modules to view it.

3. Start node. js

3.1 Node installation directory, open Node.exe.

3.2 Open cmd and enter node. Consistent with the above effect.

4.note.js Running JS file

The

Creates a new test.js in a directory with the following contents:

 var  http = require (' http '  function   //  send HTTP header  //  HTTP Status value: 200:ok  //  content type: Text/plain  response.writehead ($, {' Content-type ': ' Text/plain '  //  send response data "Hello World"  Response.End (' Hello world\n '  8888 //  terminal prints the following information  Console.log (' Server running at http://127.0.0.1:8888/'); 

Open cmd and switch to the Test.js directory:

Open Browser, type: http://127.0.0.1:8888/

Show Hello World:

Hope to be helpful to everyone.

Widows node. JS Environment Construction and Operation JS

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.