promises.js 659 Bytes
var bluebird = require('bluebird');
var promise = new Promise(function (resolve,reject) {
    resolve('success')
})
module.exports = function(Promises) {
    Promises.Ex = function (cb) {
        promise
            .then(MyFunc1())
            .then(MyFunc2());

    };
    function MyFunc1(){
        setTimeout(function(){
            console.log('first');
            return true;
        },1000);
    }
    function MyFunc2(){
        console.log('second');
    }
    Promises.remoteMethod('Ex',{
        http:{path:'/Ex',verb:'get'},
        accepts: { arg: 'ctx', type: 'object' } ,
        returns: {arg: 'data', type: 'object', root: true}
    })
};