new TemplateEngine()
A template engine uses a specific template and the data in a routing context to render a resource into a buffer.
Concrete implementations exist for several well-known template engines.
- Source:
Methods
isCachingEnabled() → {boolean}
Returns true if the template engine caches template files. If false, then template files are freshly loaded each
time they are used.
- Source:
Returns:
True if template files are cached; otherwise, false.
- Type
- boolean
render(context, templateDirectory, templateFileName, handler)
Render the template
NOTE if you call method directly (i.e. not using TemplateHandler) make sure that templateFileName is sanitized via Utils#normalizePath
Parameters:
Name | Type | Description |
---|---|---|
context |
RoutingContext | the routing context |
templateDirectory |
string | the template directory to use |
templateFileName |
string | the relative template file name to use |
handler |
function | the handler that will be called with a result containing the buffer or a failure. |
- Source: