Giriş ve çıkış fonksiyonları iyileştirildi.

This commit is contained in:
Batuhan 2025-02-16 10:21:09 +03:00
parent e3492635df
commit de06ba6056
2 changed files with 16 additions and 0 deletions

8
config.json Normal file
View File

@ -0,0 +1,8 @@
{
"serverOptions":{
"frontEnd": {
"title": "react",
"url": "http://192.168.1.27:3000"
}
}
}

View File

@ -1,6 +1,7 @@
const express = require("express");
const auth = require("../middlewares/auth");
const { getLogin } = require("../middlewares/login/query");
const data = require("../../../config.json");
const router = express.Router();
@ -27,4 +28,11 @@ router.post('/login', async (req, res) => {
};
})
router.get('/logout', async (req, res) => {
req.session.destroy();
res.clearCookie('connect.sid');
res.clearCookie('auth');
res.redirect(data.serverOptions.frontEnd.url + "/login");
})
module.exports = router;