Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@michikono
Last active December 20, 2015 21:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michikono/6201608 to your computer and use it in GitHub Desktop.
Save michikono/6201608 to your computer and use it in GitHub Desktop.
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
Copy link

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

@hellboy81
Copy link

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