0 1 00:00:01,260 --> 00:00:03,120 All right. So here's the answer to challenge 1 2 00:00:03,120 --> 00:00:11,710 12. We've deleted the console log inside our root route and instead we want to be able to log this array 2 3 00:00:11,710 --> 00:00:19,550 called posts inside our home.ejs so that when we create a new post through the compose page then 3 4 00:00:19,640 --> 00:00:25,670 once we get back onto the home page, we should be able to log that new post as well as any others that 4 5 00:00:25,670 --> 00:00:28,750 we've created previously. In order to do this 5 6 00:00:28,760 --> 00:00:36,920 we first have to pass over this posts array into the home.ejs page when we render it. In order to do that 6 7 00:00:37,220 --> 00:00:40,320 we need to add another key value pair to this 7 8 00:00:40,370 --> 00:00:42,710 essentially what is a Javascript object 8 9 00:00:42,740 --> 00:00:43,490 right? 9 10 00:00:43,580 --> 00:00:45,730 Let's add a comma after that one 10 11 00:00:45,830 --> 00:00:49,580 and then let's add our second object. 11 12 00:00:49,580 --> 00:00:54,250 And I'm just going to reformat this so that you can see it a bit more clearly. 12 13 00:00:54,290 --> 00:00:59,480 So the first object has a key of startingContent and a value of homeStartingContent which comes from 13 14 00:00:59,480 --> 00:01:00,060 here. 14 15 00:01:00,380 --> 00:01:07,130 The second object I'm going to call posts and I'm also going to pass over the posts array which comes 15 16 00:01:07,130 --> 00:01:08,150 from over here. 16 17 00:01:08,540 --> 00:01:14,570 So that means that once I render the home.ejs page I should have access to something called posts 17 18 00:01:14,900 --> 00:01:21,590 which should be the array of posts that I've created so far. Inside the home.ejs, all we need to do 18 19 00:01:21,710 --> 00:01:32,720 is to console.og that posts array. And remember that this won't work unless we add those EJS scriptlet 19 20 00:01:32,870 --> 00:01:36,830 tags which look like this. 20 21 00:01:36,830 --> 00:01:44,120 And remember that even small things such as curly braces or just a single closing curly brace also need 21 22 00:01:44,120 --> 00:01:46,560 these scriptlet tags for them to work. 22 23 00:01:46,580 --> 00:01:53,390 So let's go ahead and wrap this line of Javascript inside some EJS scriptlet tags which is an angle 23 24 00:01:53,390 --> 00:01:59,680 bracket, percentage sign and then we're going to close it off with again percentage angle bracket. 24 25 00:01:59,930 --> 00:02:09,230 So now if we hit save and we head back to our home page and we go over to the compose screen and we 25 26 00:02:09,230 --> 00:02:15,710 just compose some sort of post, hit publish and we get redirected back to the home. 26 27 00:02:15,770 --> 00:02:20,200 ejs at which point we should have passed over that posts array. 27 28 00:02:20,450 --> 00:02:27,740 So now if we check our console you can see that logged in here is the same post that we composed earlier 28 29 00:02:27,740 --> 00:02:28,240 on 29 30 00:02:28,460 --> 00:02:32,650 but in this case it's actually being logged from within our home. 30 31 00:02:32,700 --> 00:02:33,310 ejs.