Learn node project to build
1. Initialization node
cd to the specified directory, perform the initialization command
asl s init
Generates a corresponding
2. Install the desired item package
Below an example to express
--save Objective: to install it in the directory and adding dependency in package.json
# Here abbreviated NPM I - S Express # may also be used NPM the install --save Express
3. Add the default file
For example: app.js / public / views, etc.
Then app.js initialized (for the server to run up)
1 var express = require('express') 2 3 app = express() 4 5 app.get('/' , function(req,res){ 6 res.send('ok') 7 }) 8
9 app.listen(3000,function(){ 10 console.log("3000") 11 })