Skip to content

Instantly share code, notes, and snippets.

@marcusoftnet
Created May 2, 2014 04:08
Show Gist options
  • Select an option

  • Save marcusoftnet/72d768a161af173052f8 to your computer and use it in GitHub Desktop.

Select an option

Save marcusoftnet/72d768a161af173052f8 to your computer and use it in GitHub Desktop.
mounted authentication
var koa = require('koa');
var mount = require('koa-mount');
var auth = require('koa-basic-auth');
var userAuth = require('./lib/authentication.js');
var app = module.exports = koa();
// Security
app.use(userAuth.reqBasic);
app.use(mount('/results', auth(userAuth.user)));
app.use(mount('/question', auth(userAuth.user)));
// routes
// ...
// listen
app.listen(3000);
console.log('listening on port 3000');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment