1 00:00:00,310 --> 00:00:01,390 How did it go? 2 00:00:01,390 --> 00:00:04,440 Don't feel bad if you weren't able to complete it all. 3 00:00:04,440 --> 00:00:07,850 Even if you got some of the features completed, you did well. 4 00:00:07,850 --> 00:00:10,820 Now, I'll go over how I created the goodbye button. 5 00:00:12,450 --> 00:00:14,778 To create the button itself, 6 00:00:14,778 --> 00:00:20,090 I've added a form to the index.pug file right under the greeting. 7 00:00:21,370 --> 00:00:27,820 I set its action to /goodbye which is the new goodbye route. 8 00:00:27,820 --> 00:00:32,771 The method is post and in the form I've got one submit button. 9 00:00:34,488 --> 00:00:36,345 It has the text goodbye. 10 00:00:38,121 --> 00:00:46,810 In app.js I added a new post route under the hello post route called goodbye. 11 00:00:48,130 --> 00:00:52,140 I use the clear cookie method to remove the cookie's username value, 12 00:00:53,610 --> 00:00:57,080 then I redirected to the hello route. 13 00:00:58,470 --> 00:01:00,740 Let's see what we have in the browser now. 14 00:01:02,530 --> 00:01:07,173 I go to the Hello route and then I type in my name and hit enter. 15 00:01:09,336 --> 00:01:14,640 I'm redirected to the Home route and my name is displayed. 16 00:01:14,640 --> 00:01:17,550 Notice I can't get to the Hello route anymore. 17 00:01:20,500 --> 00:01:22,720 And here's the Goodbye button I implemented. 18 00:01:24,960 --> 00:01:29,190 If I click it, I'm redirected to the Hello page. 19 00:01:30,200 --> 00:01:35,230 If I try and visit the index route, I'm redirected to the Hello page. 20 00:01:37,000 --> 00:01:39,690 Great, now we have the app that stores and 21 00:01:39,690 --> 00:01:43,780 erases the cookie, it also redirects based on the cookies value. 22 00:01:44,820 --> 00:01:47,370 We've covered a lot of ground in this process. 23 00:01:47,370 --> 00:01:49,440 Well done for sticking with it. 24 00:01:49,440 --> 00:01:53,500 Next up, let's dive deeper into a fundamental feature of Express, 25 00:01:53,500 --> 00:01:54,530 called Middleware. 26 00:01:54,530 --> 00:01:55,030 See you there.