Browse Source

Add login and logout route for API

Register is also handled by login
main
Haris Razis 4 years ago
parent
commit
91208e7286
No known key found for this signature in database GPG Key ID: 86A4D290ED03FAB4
  1. 17
      server/routes/auth.js

17
server/routes/auth.js

@ -0,0 +1,17 @@
const express = require('express');
const router = express.Router();
const passport = require('passport')
router.get('/auth/login', passport.authenticate('local', {failureRedirect: '/login'},
(req, res) => {
res.redirect('/');
})
);
router.get('/auth/logout', (req, res) => {
req.logout();
res.redirect('/login');
});
module.exports = router;
Loading…
Cancel
Save