In order to start using the Templater, you only need to import it.
Require in the module and call it with the template you want hydrated, an optional Joi schema, and any options. Returns a promise.
The template to be hydrated. Can be passed in as a JSON string or an option. If not provided, this.config
will be used.
If the {{}}
template handlebar is interpolated in a string (/route/{{example.id}}
) then the returned value will be a string.
If the template handlebar is the entire template value ({{example}}
) then the returned value will be whatever the target value is.
An optional joi schema. Validation will be done against the hydrated object. This is only used if you pass in an object.
Used to override the default context from this.contexts
Passes options (such as allowUnknown
) to the Joi.validate
call if a schema is provided.