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)