How to use the actionhero.api function in actionhero

To help you get started, we’ve selected a few actionhero examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github actionhero / actionhero-tutorial / actions / createChatRoom.js View on Github external
async run ({ params, response }) {
    const { chatRoom } = ActionHero.api
    response.didCreate = await chatRoom.add(params.name)
  }
}
github actionhero / actionhero-angular-bootstrap-cors-csrf / actions / status.js View on Github external
async checkEventLoop (data) {
    const api = ActionHero.api
    const eventLoopDelay = await api.utils.eventLoopDelay(10000)
    data.response.eventLoopDelay = eventLoopDelay
    if (eventLoopDelay > maxEventLoopDelay) {
      data.response.nodeStatus = data.connection.localize('Node Unhealthy')
      data.response.problems.push(data.connection.localize(['EventLoop Blocked for more than {{maxEventLoopDelay}} ms', { maxEventLoopDelay: maxEventLoopDelay }]))
    }
  }
github actionhero / actionhero-tutorial / actions / status.js View on Github external
async checkResqueQueues (data) {
    const api = ActionHero.api
    const details = await api.tasks.details()
    let length = 0
    Object.keys(details.queues).forEach((q) => {
      length += details.queues[q].length
    })

    data.response.resqueTotalQueueLength = length

    if (length > maxResqueQueueLength) {
      data.response.nodeStatus = data.connection.localize('Node Unhealthy')
      data.response.problems.push(data.connection.localize(['Resque Queues over {{maxResqueQueueLength}} jobs', { maxResqueQueueLength: maxResqueQueueLength }]))
    }
  }
github actionhero / actionhero-tutorial / actions / showDocumentation.js View on Github external
run ({ response }) {
    const { documentation } = ActionHero.api
    response.documentation = documentation.documentation
  }
}
github actionhero / actionhero-angular-bootstrap-cors-csrf / actions / showDocumentation.js View on Github external
run ({ response }) {
    const { documentation } = ActionHero.api
    response.documentation = documentation.documentation
  }
}