Create a gist now

Instantly share code, notes, and snippets.

@michikono /kue.js
Last active Dec 20, 2015

module.exports = function (app, config, passport, express) {
var kue = require("kue");
var auth = express.basicAuth(function(user, pass, callback) {
var result = (user === 'username' && pass === 'password');
callback(null /* error */, result);
});
// any kue related settings can go here
kue.app.set('title', 'Jobs');
// create a wrapper to add auth on since without it we can't globally wrap kue's paths
var subApp = express()
// add authentication
subApp.use(auth)
// re-add kue.app (but dont put it in its own folder)
subApp.use('', kue.app)
// bind the subApp to the desired path
app.use('/secret_location/kue', subApp)
};
var app = express()
// needs to come early due to order mattering
require('./config/kue')(app, config, passport, express)
// express settings
require('./config/express')(app, config, passport)
// the rest of your routes, etc.
@hellboy81

Error: Internal: Object function createApplication() has no method 'basicAuth'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment