0

I have JSON file called twitData.json that looks like this: JSON file

I want to iterate over it using Handlebars and Express, and pass it to a partial to be implemented as html code. I have included the JSON file in server.js. I use res.render in server.js to try and pass the elements of JSON to the partial. Like this: res.render('twitPage', {twitData}) . and for my handlebars file I use

{{each .}}
{{twit}}
{{/each}}
The partial I am using, twit.handlebars, looks like this. It needs two arguments. I am supposed to pass the arguments somehow using res.render.

enter image description here

The main parts I do not understand is what to put as the second argument in res.render, and what I should put for the context in the {{each}} helper. Any ideas would be appreciated. If you need more info, I can supply.

here is twitPage.handlebars:

enter image description here

here is server.js: enter image description here

DSATH
  • 23
  • 5

0 Answers0