/fork2-node-greet

Greet to Node.js

Primary LanguageJavaScript

#Readme
##Lessons
This project is for
Warmup 1 - Create An NPM Package
Warmup 2 - Setting Up Mocha For Testing
Warmup 3 - Using CoffeeScript

##Notes
###Warmup 1

  1. nvm is for controling multiple version of node. If one don't need to, check note 2 while no find path "~/.nvm/"

  2. Default path on OS X is /usr... if install by binary. So write
    export NODE_PATH=/usr/local/lib/node_modules
    into ~/.bashrc

  3. There are two paths for npm. Gernal package install to $NODE_PATH may be better. Check npm 1.0: Global vs Local installation

  4. The process object has lot of infomation. Could be very useful.

  5. Node command line runtime may need to quit to refresh modules?

  6. require is to get an entrance function of a package. A package is a module that has single objection. An executable in ./bin is separate from the module it self. But usually they have same purpose.

  7. npm install XXX --save-dev is for dev using packages, like test.
    npm install XXX --save is for both dev and release.
    Also npm link can make local package global.

###Warmup 2

  1. BDD:Behavior Driven Development. Using nature language to describe test case, and push development.

  2. In browsers using var something will define a global variable. In Node using global.XXX to define a true top-level & cross-module global variable. var something inside a Node module will be local to that module.

  3. Test Sample

describe('case/module name', function(){  
  it("case 1 content", function(){  
    expect(do sth).xx.xxx(output);
  });
  it("case 2 content", function(){  
    expect(do sth).xx.xxx(output);
  });
  ....
});

###Warmup 3