1.1.1 • Published 7 years ago

bono-auth v1.1.1

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

node-bono-auth

const Bundle = require('bono');
const auth = require('bono-auth');

const secret = 'this is secret';
const app = new Bundle();

auth.use(async ctx => {
  let { username, password } = await ctx.parse();
  if (username === 'admin' && password === 'password') {
    return { username };
  }
});

app.use(auth.authenticate({ excludes: [ '/auth' ] }));

app.bundle('/auth', new auth.Bundle({ secret }));

app.listen(3000);
1.1.1

7 years ago

1.1.0

7 years ago