Glue Auth
Module that allows to manage all the authentication of an application including the sending of emails
Usage
router.use(['/auth/*'], endpoints.routes(), endpoints.allowedMethods())
router.use('/api/*', authorize)
router.get('/api/demo', (ctx, next) => { ctx.body = 'Hello, visitor!' })
router.get('/api/user/getMe', requireLoggedIn, (ctx, next) => { ctx.body = 'Hello, user ' + ctx.user.id })
router.get('/api/admin/demo', requireRole('ADMIN'), (ctx, next) => { ctx.body = 'Hello, admin ' + ctx.user.id })
Developing
To try your changes in @gluedigital/auth, clone this repo and use yarn link
, then
link it in the demo project with yarn link @gluedigital/auth
. We also provide a
"watch mode" to rebuild the bundle on change, which you can start with
yarn watch
.