"Learning Notes" node. JS Learning Note (ii)

Source: Internet
Author: User

Iii. using node. js for Web Development

1. Install Express

    Express is the officially recommended Web development framework and is very powerful.

Enter NPM Install-g Express on the command line for global installation Express

    

This means that the installation is complete. But at this point we do not succeed in executing the express-h command, because express4.0 will need to install the Express-generator package to execute the Express command.

Re-install the Express-generator package: NPM install-g express-generator

So you can use Express command.

       

  2. Establishment of the project

    Express needs to specify the engine frame when initializing the project, the default bit jade, and the Ejs. Ejs is a label replacement engine, similar to PHP, so I decided to learn it based on it. And Jade is a complete set of syntax used to generate HTML for each tag structure, powerful and complex, so later to learn slowly.

    After the new version, enter EXPRESS-E Ejs microblog

    

This creates a new project, which is also a reminder of the need to install dependencies

We can enter CD microblog && NPM intall.

Enter the bin directory, input node Www.js can access the local server, in the browser input http://localhost:3000/can be seen.

"Learning Notes" node. JS Learning Note (ii)

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.