1.nodejs Installation
Installation location: node for launching a nodejs JavaScript engine
NPM: You can use this command to manage NODEJS packages
Node_modules: The folder contains the installed Nodejs package
NPM Command line Options
Find a package: NPM search NPM Package Name
Installation package: NPM Install NPM package name
2. Encapsulation of the module
So the node module must contain a Package.json file in its root directory, which can contain several different instructions to tell node how the package Manager handles the module.
3. Create a node application
After writing the module, you need to have Package.json, README. MD is a descriptive file that can be written casually.
Encapsulation Module command: NPM Pack generates a file with the suffix tgz
4. Publish a node wrapper module to the NPM registry
1 Create a common repository that contains the code for the module, for example, on GitHub Https://github.com/node/nodebook/nodeDB
2 Create an account in Https://npmjs.org/signup
3 Add the created user to the environment with a command
NPM AddUser Enter your account password email
4 Modify the Package.json to add and improve the good information
5 Release the module using NPM Publish in the console of the project
Once published, you can download and search
Unpublish NPM unpublish project name
In some cases, if the--force option is not applicable, you will not be able to unpublish the module, which forces the module to be clear and removed from the registry.
NPM unplish Node Package--force
5. Using the node wrapper module in the node application
Require (' node package ')
Require ('./lib/util.js ') Note: The extension is optional
6 Speaking data write to console
Because the console module is very versatile, you do not need to use require () he loads into your module you just need to use the console. Functions (Parameters)
Nodejs+mongodb+angularjs's Way of learning the first chapter