How to use the actionhero.api.routes 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 / ah-resque-ui / initializers / ah-resque-ui.js View on Github external
async initialize () {
    /* ----- Route Injection ----- */

    api.routes.registerRoute('get', '/resque/packageDetails', 'resque:packageDetails')
    api.routes.registerRoute('get', '/resque/redisInfo', 'resque:redisInfo')
    api.routes.registerRoute('get', '/resque/resqueDetails', 'resque:resqueDetails')
    api.routes.registerRoute('get', '/resque/queued', 'resque:queued')
    api.routes.registerRoute('get', '/resque/loadWorkerQueues', 'resque:loadWorkerQueues')
    api.routes.registerRoute('get', '/resque/resqueFailedCount', 'resque:resqueFailedCount')
    api.routes.registerRoute('get', '/resque/resqueFailed', 'resque:resqueFailed')
    api.routes.registerRoute('get', '/resque/delayedjobs', 'resque:delayedjobs')
    api.routes.registerRoute('get', '/resque/locks', 'resque:locks')

    api.routes.registerRoute('post', '/resque/removeFailed', 'resque:removeFailed')
    api.routes.registerRoute('post', '/resque/retryAndRemoveFailed', 'resque:retryAndRemoveFailed')
    api.routes.registerRoute('post', '/resque/removeAllFailed', 'resque:removeAllFailed')
    api.routes.registerRoute('post', '/resque/retryAndRemoveAllFailed', 'resque:retryAndRemoveAllFailed')
    api.routes.registerRoute('post', '/resque/forceCleanWorker', 'resque:forceCleanWorker')
    api.routes.registerRoute('post', '/resque/delQueue', 'resque:delQueue')
    api.routes.registerRoute('post', '/resque/delDelayed', 'resque:delDelayed')
github actionhero / ah-resque-ui / initializers / ah-resque-ui.js View on Github external
api.routes.registerRoute('get', '/resque/resqueDetails', 'resque:resqueDetails')
    api.routes.registerRoute('get', '/resque/queued', 'resque:queued')
    api.routes.registerRoute('get', '/resque/loadWorkerQueues', 'resque:loadWorkerQueues')
    api.routes.registerRoute('get', '/resque/resqueFailedCount', 'resque:resqueFailedCount')
    api.routes.registerRoute('get', '/resque/resqueFailed', 'resque:resqueFailed')
    api.routes.registerRoute('get', '/resque/delayedjobs', 'resque:delayedjobs')
    api.routes.registerRoute('get', '/resque/locks', 'resque:locks')

    api.routes.registerRoute('post', '/resque/removeFailed', 'resque:removeFailed')
    api.routes.registerRoute('post', '/resque/retryAndRemoveFailed', 'resque:retryAndRemoveFailed')
    api.routes.registerRoute('post', '/resque/removeAllFailed', 'resque:removeAllFailed')
    api.routes.registerRoute('post', '/resque/retryAndRemoveAllFailed', 'resque:retryAndRemoveAllFailed')
    api.routes.registerRoute('post', '/resque/forceCleanWorker', 'resque:forceCleanWorker')
    api.routes.registerRoute('post', '/resque/delQueue', 'resque:delQueue')
    api.routes.registerRoute('post', '/resque/delDelayed', 'resque:delDelayed')
    api.routes.registerRoute('post', '/resque/runDelayed', 'resque:runDelayed')
    api.routes.registerRoute('post', '/resque/delLock', 'resque:delLock')

    /* ----- Proxy Middleware ----- */

    const middleware = {
      'ah-resque-ui-proxy-middleware': {
        name: 'ah-resque-ui-proxy-middleware',
        global: false,
        preProcessor: () => { },
        postProcessor: () => { }
      }
    }

    if (api.config['ah-resque-ui'].middleware && api.config['ah-resque-ui'].middleware.length > 0) {
      middleware['ah-resque-ui-proxy-middleware'].preProcessor = async (data) => {
        for (const i in api.config['ah-resque-ui'].middleware) {