diff --git a/routes/logout.js b/routes/logout.js index 04f7f15..b18032e 100644 --- a/routes/logout.js +++ b/routes/logout.js @@ -2,8 +2,7 @@ const express = require('express'); const db = global.db; const router = express.Router(); -// GET /login -router.get('/', (req, res) => { +const logout = (req, res) => { req.session.destroy(err => { if (err) { global.log.error(`Error destroying session during logout: ${err}`); @@ -11,6 +10,12 @@ router.get('/', (req, res) => { } res.redirect('/login'); }); -}); +}; + +// GET /login +router.get('/', logout); +router.post('/', logout); +router.delete('/', logout); + module.exports = router; \ No newline at end of file