node. JS's web Framework Express first attempt!

Source: Internet
Author: User

Environment: Win7 64+node.js v0.10.33+npm 1.4.28+git Bash (Disclaimer: The following may be different, because this part of me is done in the company, part of it is done at home, but the commands and steps are the same)

1. Install Express

Enter NPM Install-g Express in the console (choose Global installation here)

In the command tool for installing Express, the command tool is split up in the console by entering NPM install-g express-generator "latest express4.0+ version (Project address: https://github.com/ Expressjs/generator) "

Test for installation success: Enter Express--help in the console, as shown below to indicate successful installation

New Express project here, behind the Express, is the project directory Express_example

Enter the Express_example directory, NPM installation, or you can do it together: CD express_example && NPM Install

After installation, you can look at the files and directories under the directory, which is expess by default (can also be changed, but in view of my first contact with the inconvenience of writing on the fear that I write is wrong and mislead everyone)

Startup Project starts on the command line: NPM Start (the latest version of Express requires this startup method, not the node app.js as many books and posts have previously said)

Then enter in the browser: location:3000, enter will see the following interface, representing the success

You can then look back at the console and here is some output from the Console.log in the Express code

This is where my Express entry begins!

node. JS's web Framework Express first attempt!

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.