1. Vonage Learn
  2. It
  3. Courses
  4. Onehack
  5. Node
  6. 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.