Skip to content

Commit

Permalink
feat: add delete token
Browse files Browse the repository at this point in the history
  • Loading branch information
mbadr2200 committed Dec 16, 2022
1 parent 5539629 commit dbd9bc0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,17 @@ app.post('/users/login', (req,res) => {
});
});

// logout the user
app.delete('/users/me/token' , authunticate , (req,res) => {
req.user.removeToken(req.token)
.then(() => {
res.status(200).send();
})
.catch((e) => {
res.status(400).send();
})
});

// log in with exsiting user
app.get('/users/me',authunticate,(req,res) => {
res.send(req.user);
Expand Down

0 comments on commit dbd9bc0

Please sign in to comment.