Created
April 10, 2016 16:36
-
-
Save vdeturckheim/dbf3868d4461553b4d1a20043790ccab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const AuthService = require('../services/auth.service'); | |
// { method: ['GET', 'POST'], path: '/login', config: AuthController.login } | |
module.exports.login = { | |
description: 'Sign-in a user in the app', | |
tags: ['auth'], | |
auth: 'github', | |
handler: function (request, reply) { | |
request.log(['auth'], `login ${request.auth.credentials.username}`); | |
return reply(AuthService.githubHandler(request.auth.credentials)); | |
} | |
}; | |
// { method: 'GET', path: '/logout', config: AuthController.logout } | |
module.exports.logout = { | |
description: 'lougout a user', | |
tags: ['auth'], | |
handler: function (request, reply) { | |
request.log(['auth'], `logout ${request.auth.credentials._id}`); | |
return reply(AuthService.removeToken(request.auth.credentials._id)); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment