ActionHero’s Resque UI

actionhero javascript node.js 
↞ See all posts

Today I released a Resque UI for ActionHero, ah-resque-ui.

This project has been in the works for a *long time*. I started the node-resque project at @TaskRabbit in 2013… and until now, there has been no Node.js way to view the data in your resque Redis databse. I’ve been advising folks to spin up the Ruby resque-web project if they needed a UI… but that wasn’t a very good solution for a Node.js project!

For those of you who don’t know, Resque is a specification for a few data structures, implemented in Redis, which is used to enqueue, store, and work delayed jobs in a software application. Reque was first written by the folks at @github in Ruby, and has since been extended to almost every other language. There are even alternative implementations of the workers (the running code which consume and works these enqueued jobs) in Ruby, most famously Sidekiq. Resque is the backing store for ActionHero’s Task system.

ah-resque-ui creates a number of actions which interface with ActionHero’s task system, and therefore node-resque under the hood. The front end is written in Angular 1.5. This plugin uses route injection and a proxy middleware so you can protect your actions (as they do allow you to mess with server-side data). This is the first time I’ve used the proxy-middleware pattern, and I quite like it:

1module.exports = { 2 load: 99999999, 3 initialize: function (api, next) { 4 var middleware = { 5 "ah-resque-ui-proxy-middleware": { 6 name: "ah-resque-ui-proxy-middleware", 7 global: false, 8 preProcessor: function (data, callback) { 9 return callback(); 10 }, 11 }, 12 }; 13 if (api.config["ah-resque-ui"].middleware) { 14 var sourceMiddleware = 15 api.actions.middleware[api.config["ah-resque-ui"].middleware]; 16 middleware["ah-resque-ui-proxy-middleware"].preProcessor = 17 sourceMiddleware.preProcessor; 18 middleware["ah-resque-ui-proxy-middleware"].postProcessor = 19 sourceMiddleware.postProcessor; 20 } 21 api.actions.addMiddleware(middleware["ah-resque-ui-proxy-middleware"]); 22 next(); 23 }, 24};

You can download ah-resque-ui from NPM and add it as a plugin to your ActionHero project with a simple:

npm install --save ah-resque-ui npm run actionhero -- link --name ah-resque-ui


Hi, I'm Evan

I write about Technology, Software, and Startups. I use my Product Management, Software Engineering, and Leadership skills to build teams that create world-class digital products.

Get in touch