summaryrefslogtreecommitdiff
path: root/routes/logout.js
blob: a31d9fe9c5b264947ee52c1888e962be786577be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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) {
		req.session.destroy();
	}
	return res.redirect(302, "/");
});

export default router;