Back to topic list

Temper

Temper renders a template with a provided context.

function render(filename, context)

  • @ filename (string) – path to the template relative to the /pages folder.
  • @ context (object) – data to be passed onto the handlebars template
  • > returns (promise) with processed html data as a payload

Example usage

/pages/user.hbs content:

<div>user's name: {{user_name}}</div>

We can render this template by create an express route in the /app/app.js file:

app.get('/user', function (req, res) {
    enduro.api.temper.render('user', { user_name: 'martin' })
        .then((output) => {
            res.send(output)
        })
})
Back to topic list

Shout out to pexels and freepik