Tutorial Steps
-
- Run npm init
$ git clone https://github.com/jspenc72/node-promise-tutorial
$ cd node-promise-tutorial
$ mkdir mytutorial
$ cd mytutorial
$ npm init
-
- Add Bluebird promis library as a dependency
$ npm install bluebird -save
-
- Create index.js
$ touch index.js
Install dependencies:
$ npm install
Promise Code Sample
var Promise = require('bluebird');
var myFunction = function(){
return new Promise(function(resolve, reject){
})
}