node.js Back
Basic
i. Update the version of node
and npm
- check the version
npm -v
- get the
n
sudo npm install -g n
- get the stable version of node.js
sudo n stable
- update npm
sudo npm install -g npm@latest
sudo npm install -g npm@lts
ii. Require models
- install models
# install it in the local directory
npm install <model_name>
or
# install it in the global environment
sudo npm install -g <model_name>
- use the models (eg. request)
var request = require('request');
iii. Run the script
node script.js