summaryrefslogtreecommitdiff
path: root/routes/logout.js
blob: a92085a5c1e83695154c6f8af65b8e674a5e4682 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import express from "express";

import session from "../middlewares/sessions.js";

const router = express.Router();
router.use(session);

router.get("/", (req, res) => {
	if (req.session.user !== undefined) {
		res.clearCookie("JDMSessionId");
		req.session.destroy();
	}
	return res.redirect(302, "/");
});

export default router;