1. Vonage Learn
  2. Courses
  3. Onehack
  4. Node
  5. Introducing Nunjucks

Introducing Nunjucks

Learn how to use Node.js, Express.js and Nunjucks to create dynamic web applications

Configure Nunjucks

nunjucks.configure('views', { autoescape: true, express: app });

hello.html

<!doctype html>
<html>
    <head>
        <title>OneHack Academy</title>
    </head>
    <body>
        <h1>Hello, {{name}}!</h1>
    </body>
</html>

GET /hello/:name Route Handler

app.get('/hello/:name', function(req, res) {
    res.render('hello.html', {
        name: req.params.name
    })
});

Need help? Have questions? Join the Vonage Developer Community Slack and use the channel #onehack.