What is NPM? It is a package management tool for NODEJS
Official website: www.npmjs.com
There are now thousands of free package management tools available for free use
For example, if I want to install upper-case, I can enter the following in the command line
[php]npm install upper-case [/php]
Then in C:UsersMy Namenode_modulesupper-case
this module will appear
Using modules
[php]var uc = require(‘upper-case’);[/php]
Below is a node.js example
[php]
var http = require(‘http’);
var uc = require(‘upper-case’);
http.createServer(function (req, res) {
res.writeHead(200,
{‘Content-Type’: ‘text/html’});
res.write(<strong>uc(“Hello
World!”)</strong>);
res.end();
}).listen(8080);
[/php]
Then run the initialization
[php]
node node.js
[/php]