I am trying to incorporate the Passport logout function into one of my get-request routes for express and it doesn't seem to be destroying the session. After I make a logout request the endpoint that I am trying to hide is still accessible.
Here is the code:
const express = require('express');
const router = express.Router();
const app = express();
const path = require('path');
const passport = require('passport');
const passportHttp = require('passport-http');
const logout = require('express-passport-logout');
router.get('/', function (req, res) {
logout();
console.log('logged out');
res.sendFile(path.resolve('./public/logout.html'));
})
module.exports = router;
Any help would be appreciated! Thanks!