NODE-LESSONS0 1 2

Source: Internet
Author: User

Tutorial: Https://github.com/alsotang/node-lessons/tree/master/lesson0

0

The full name of the NVM is node version Manager, which requires this tool because the various features of node. js are not stable, so we often need to switch versions because of the old project or beginning something new.

Installation: $ curl-o-https://raw.githubusercontent.com/creationix/nvm/v0.25.2/install.sh | Bash

Installing NODE:NVM Install 0.12

View: NVM ls

1

View the modules installed for this project

LS Node_modules

or NPM list, which is global and has a certain structure

2

NPM init Initializes a copy of the simple Package.json

NPM Install Express Utility--save can be installed in two modules at a time---is the Save

Utility contains a lot of auxiliary methods, and crypto is just a separate encryption;

3 crawler

Superagent:http aspects of the library, you can initiate a GET or POST request

Take a good look at Superagent's API, which plays the style of chained calls to the extreme

4 concurrency

Eventproxy never touched.

5async

Async Demo:https://github.com/alsotang/async_demo

Can control the number of concurrent: maplimit; Queue

This verse is really good.

5 Testing

Require.main = = Module://If the main.js is executed directly, enter here //If Main.js is require by another file, it will not be executed here.

exports:http://liuzhichao.com/p/1669.html If you want your module to be a specific type just use Module.exports. If the module you want is a typical "instanced object", use exports.

var n = number (process.argv[2]); Generally use + process is also an object

Mian.text cannot introduce main? Similar words require ('./main ');

Execution test: Mocha Main.test

var main = require ('./main '); var should = require (' should ');d escribe (' Main.test.js ', function () {It (' should equal n = = =, function () {Main.fibonacci (). Should.equal (55);})})

A string in describe that describes what the subject you are testing, and it describes the specific case content.

Mocha Test Library

Should assertion library

Expect assertion Library

This is the legendary test-driven development: first describe the purpose to be achieved, and then let the existing program run out of case, and then fix the procedure to let case pass.

Istanbul coverage

Open to see: Open coverage/lcov-report/index.html can also be opened directly on the page

makefile:http://blog.csdn.net/haoel/article/details/2886

NODE-LESSONS0 1 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.