From 404eb797b94418aaf8d487d096b8beac04967a24 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 24 Sep 2024 00:01:32 +0530 Subject: [PATCH] feat: current user route --- server/src/routes/auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/routes/auth.ts b/server/src/routes/auth.ts index 9a50cd3c..d1e103d1 100644 --- a/server/src/routes/auth.ts +++ b/server/src/routes/auth.ts @@ -74,11 +74,11 @@ router.get('/logout', async (req, res) => { } }) -const currentUser = async (req, res) => { +router.get('/current-user', async (req, res) => { try { const user = await User.findById(req.user._id).select('-password').exec(); return res.status(200).json({ ok: true }); } catch (error) { return res.status(500).send(`Could not fetch current user : ${error.message}.`); } -}; \ No newline at end of file +}); \ No newline at end of file