WEBVTT 0 00:01.260 --> 00:03.120 All right. So here's the answer to challenge 1 00:03.120 --> 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 00:11.710 --> 00:19.550 called posts inside our home.ejs so that when we create a new post through the compose page then 3 00:19.640 --> 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 00:25.670 --> 00:28.750 we've created previously. In order to do this 5 00:28.760 --> 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 00:37.220 --> 00:40.320 we need to add another key value pair to this 7 00:40.370 --> 00:42.710 essentially what is a Javascript object 8 00:42.740 --> 00:43.490 right? 9 00:43.580 --> 00:45.730 Let's add a comma after that one 10 00:45.830 --> 00:49.580 and then let's add our second object. 11 00:49.580 --> 00:54.250 And I'm just going to reformat this so that you can see it a bit more clearly. 12 00:54.290 --> 00:59.480 So the first object has a key of startingContent and a value of homeStartingContent which comes from 13 00:59.480 --> 01:00.060 here. 14 01:00.380 --> 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 01:07.130 --> 01:08.150 from over here. 16 01:08.540 --> 01:14.570 So that means that once I render the home.ejs page I should have access to something called posts 17 01:14.900 --> 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 01:21.710 --> 01:32.720 is to console.og that posts array. And remember that this won't work unless we add those EJS scriptlet 19 01:32.870 --> 01:36.830 tags which look like this. 20 01:36.830 --> 01:44.120 And remember that even small things such as curly braces or just a single closing curly brace also need 21 01:44.120 --> 01:46.560 these scriptlet tags for them to work. 22 01:46.580 --> 01:53.390 So let's go ahead and wrap this line of Javascript inside some EJS scriptlet tags which is an angle 23 01:53.390 --> 01:59.680 bracket, percentage sign and then we're going to close it off with again percentage angle bracket. 24 01:59.930 --> 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 02:09.230 --> 02:15.710 just compose some sort of post, hit publish and we get redirected back to the home. 26 02:15.770 --> 02:20.200 ejs at which point we should have passed over that posts array. 27 02:20.450 --> 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 02:27.740 --> 02:28.240 on 29 02:28.460 --> 02:32.650 but in this case it's actually being logged from within our home. 30 02:32.700 --> 02:33.310 ejs.