From de06ba6056efe114d12b379b85cbd179dcb5780f Mon Sep 17 00:00:00 2001 From: Batuhan Date: Sun, 16 Feb 2025 10:21:09 +0300 Subject: [PATCH] =?UTF-8?q?Giri=C5=9F=20ve=20=C3=A7=C4=B1k=C4=B1=C5=9F=20f?= =?UTF-8?q?onksiyonlar=C4=B1=20iyile=C5=9Ftirildi.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.json | 8 ++++++++ modules/logins/routes/home.js | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 config.json diff --git a/config.json b/config.json new file mode 100644 index 0000000..3cba88e --- /dev/null +++ b/config.json @@ -0,0 +1,8 @@ +{ + "serverOptions":{ + "frontEnd": { + "title": "react", + "url": "http://192.168.1.27:3000" + } + } +} \ No newline at end of file diff --git a/modules/logins/routes/home.js b/modules/logins/routes/home.js index 0ff1f51..f5b5dbf 100644 --- a/modules/logins/routes/home.js +++ b/modules/logins/routes/home.js @@ -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; \ No newline at end of file