1. Vonage Learn
  2. It
  3. Courses
  4. Onehack
  5. Node
  6. Looping With Nunjucks

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.