Order--
The "node. JS self-paced" series of articles will document my learning process for Web development based on node. js.
node. JS is a development platform based on the V8 engine that performs JavaScript faster and with good performance, and because it is a language for development in JavaScript, it has a lower learning curve and more efficient development for front-end engineers.
I. Installing node. js
1. Go to the node. JS website to download and install
2. Start the cmd Input command to view the node and NPM versions
Node-vnpm-v
NPM is the package Manager that node comes with when it finishes installation
Ii. installation of Express
Express is the most common Web application development framework under node platform
1. Global Installation Express
NPM Install-g Express
WIN7 environment is installed globally under the C:\Users\Administrator\AppData\Roaming\npm\node_modules folder
2. Global Install Express command line tool
NPM install-g Express-generator
In the latest version of 4.x, command-line tools have been isolated
3. View Express version
Express-v
4. Update the Installed Express
NPM Update-g Express
Iii. creating a project using Express
1. Create a project
Express App_name
Express defaults to Jade as the template engine
2. Create a project with Ejs as a template engine
Express-e app_name
3. Installing dependent Packages
Go to the project folder and execute:
NPM Install
Download all dependent packages recorded in Package.json to the Node_modules folder
Iv. Start-up service
1. Start
NPM start
Listen to the Bin/www file, the default port is 3000, can be changed in the www file
2. Open the browser and enter localhost:3000
3. Automatic Restart Service
Open Package.json can see that the command to listen to the Bin/www file is node
Using node monitoring will result in the need to manually restart the service after each code modification, which can be automatically restarted using Nodemon
NPM install-g Nodemon
You can also use the following command to view its version
Nodemon-v
Modify the code in the Package.json file to:
"Start": "Nodemon./bin/www"
Re-execute:
NPM start
Next, you will be able to code the arbitrary ...
#########################################
node. JS is growing fast, packages are upgraded quickly, and articles are not available in the official documentation. I also do not update the article regularly, try to maintain the usability of the article code.
#########################################
@zhnoah
Source: http://www.cnblogs.com/zhnoah/
This article is owned by me and the blog Park, Welcome to reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original
The right to pursue legal liability.
node. JS Self-study Road--1. Environment construction