Alright. Onwards and upwards. Challenge 12. In order to complete this challenge the first thing I need you to do 1
is to delete this console log inside our app.js. Make sure that there's no other log statements inside 2
this file other than inside our app.listen because instead of logging the posts inside here, I want you 3
to be able to pass it over to our home. 4
ejs 5
and log it from here instead. 6
There's a couple of steps to this and you might have to think about it but this is the end outcome. You 7
want to be able to log exactly the same thing, the post array, 8
but this time inside the home.ejs. Pause the video, give it a think and give it a go. 9
All right. 10
Here's my first hint. 11
Remember that using res.render 12
the second parameter that we're passing in to this function is essentially a Javascript object. And we've 13
already seen what Javascript objects look like and we know that you can have more than one key value 14
pair as long as you simply just add a comma in between them. 15
So instead of simply just passing over the starting content, we also want to pass over the posts array 16
using this res.render method. 17
So pause the video and see if that was enough of a hint to complete the challenge. 18
All right. 19
Here comes hint number 2. 20
If you look at the EJS docs you know that there's a whole bunch of different tags that we can use. 21
And the one that we've shown you before is the scriptlet tag which allows you to write Javascript inside 22
the EJS file. 23
With that in mind you should be able to complete the challenge and log the posts array from within the 24
home.ejs file. Pause the video and complete the challenge.