feat: implement logOutUser

This commit is contained in:
Renge 2022-09-24 21:51:39 -04:00
parent 76849cc747
commit ee6c5fd5f1
2 changed files with 11 additions and 0 deletions

View File

@ -15,6 +15,15 @@ loginUser = async (req, res) => {
return await assert("login", req, res); return await assert("login", req, res);
} }
logoutUser = async (req, res) => {
return await res.cookie("token", '', {
httpOnly: true,
secure: true,
sameSite: "lax"
}).status(200).json({
success: true
})
}
const assert = async (queueName, req, res) => { const assert = async (queueName, req, res) => {
amqp.connect(rabbitMQ, function (error0, connection) { amqp.connect(rabbitMQ, function (error0, connection) {
@ -75,4 +84,5 @@ const assert = async (queueName, req, res) => {
module.exports = { module.exports = {
registerUser, registerUser,
loginUser, loginUser,
logoutUser,
} }

View File

@ -4,5 +4,6 @@ const UserAPI = require('../apis/user-apis')
router.post('/login', UserAPI.loginUser) router.post('/login', UserAPI.loginUser)
router.post('/register', UserAPI.registerUser) router.post('/register', UserAPI.registerUser)
router.get('/logout', UserAPI.logoutUser)
module.exports = router module.exports = router