auth-controller.js 560 B

1234567891011121314151617181920
  1. var authController = {};
  2. //Function to get the user info and return it in json
  3. authController.getUser = function (req, res) {
  4. if (req.user && req.user.id) {
  5. res.json(req.user);
  6. return;
  7. }
  8. res.status(400).json(null);
  9. };
  10. //Function to logout
  11. authController.logout = function (req, res) {
  12. req.logout();
  13. res.redirect('/');
  14. };
  15. //Function to login? Not sure, might be able to remove this or move some router functions to here?
  16. authController.login = function (req, res) {
  17. res.redirect('/');
  18. };
  19. module.exports = authController;