Skip to content

Commit 02bf369

Browse files
author
codingChewie
committed
Solution: Clearing Cookies and Redirecting
1 parent f93b23e commit 02bf369

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

app.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,9 @@ app.post('/hello', (req, res) => {
3838
res.redirect('/')
3939
})
4040

41+
app.post('/goodbye', (req, res) => {
42+
res.clearCookie('username')
43+
res.redirect('/hello')
44+
})
45+
4146
app.listen(3000, () => console.log('The app is running on port 3000'))

views/index.pug

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ extends layout.pug
33
block content
44
section#content
55
h2 Welcome, #{name}!
6+
form(action='/goodbye', method='POST')
7+
button(type='submit') Goodbye
68

0 commit comments

Comments
 (0)