Looping with Nunjucks
Learn how to use Node.js, Express.js and Nunjucks to create dynamic web applications
GET / Route Handler
app.get('/', function(req, res) {
res.render('index.html', {
list: films
})
});
index.html
<!doctype html>
<html>
<head>
<title>OneHack Academy</title>
</head>
<body>
<ul>
{% for film in list %}
<li>
<a href="/film/{{film.id}}">
{{ film.name }}
</a>
</li>
{% endfor %}
</ul>
</body>
</html>
Need help? Have questions? Join the Vonage Developer Community Slack and use the channel #onehack.