Skip to content

This plugin (under development) provides promise chain support for ActionHero action functions that return a Bluebird "thenable" promise.

License

Notifications You must be signed in to change notification settings

dangerdespain/ah-bluebird-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Installation

npm install ah-bluebird-plugin --save or yarn add ah-bluebird-plugin

Install plugin using instructions from https://www.actionherojs.com/docs/core/#plugins

Now try returning a promise inside of an action! The promise's result will be set at data.result and the request completed. If anything lands in the .catch(err) method, it'll pipe through AH's error formatter.

Example Action:

var Bluebird = require('bluebird');

exports.promiseExample = {
  name: 'promiseExample',
  description: 'I am an example of an action returning a promise',
  outputExample: {
    result:"hello world!",
    action:"promiseExample",
    serverInformation:Object,
    requestDuration:5,
  },
  inputs: {},

  run: function (api, data, next) {
    return new Bluebird.Promise(function(resolve, reject){
      resolve('hello world!');
    })
  }
}

About

This plugin (under development) provides promise chain support for ActionHero action functions that return a Bluebird "thenable" promise.

Resources

License

Stars

Watchers

Forks

Packages

No packages published