what does it then in promise code example
Example: nodejs promise then example
p.then(onFulfilled, onRejected);
p.then(function(value) {
// run
}, function(reason) {
// fail
});
p.then(onFulfilled, onRejected);
p.then(function(value) {
// run
}, function(reason) {
// fail
});