Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TemplateEngine

A template template 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.

Hierarchy

  • TemplateEngine

Index

Methods

clearCache

  • clearCache(): void
  • Clears any internal caches used by this engine. For most engines this means clearing the vert.x cache, implementations that do not use vert.x as a cache should clear their own cache.

    Returns void

render

  • render(context: {}, templateFileName: string): PromiseLike<Buffer>
  • render(context: {}, templateFileName: string, handler: ((res: AsyncResult<Buffer>) => void) | Handler<AsyncResult<Buffer>>): void
  • render(context: {}, templateFileName: string): PromiseLike<Buffer>
  • render(context: {}, templateFileName: string, handler: ((res: AsyncResult<Buffer>) => void) | Handler<AsyncResult<Buffer>>): void
  • Render the template. Template engines that support partials/fragments should extract the template base path from the template filename up to the last file separator.

    Some engines support localization, for these engines, there is a predefined key "lang" to specify the language to be used in the localization, the format should follow the standard locale formats e.g.: "en-gb", "pt-br", "en".

    Parameters

    • context: {}
      • [key: string]: any
    • templateFileName: string

    Returns PromiseLike<Buffer>

  • Render the template. Template engines that support partials/fragments should extract the template base path from the template filename up to the last file separator.

    Some engines support localization, for these engines, there is a predefined key "lang" to specify the language to be used in the localization, the format should follow the standard locale formats e.g.: "en-gb", "pt-br", "en".

    Parameters

    • context: {}
      • [key: string]: any
    • templateFileName: string
    • handler: ((res: AsyncResult<Buffer>) => void) | Handler<AsyncResult<Buffer>>

    Returns void

  • Render the template. Template engines that support partials/fragments should extract the template base path from the template filename up to the last file separator.

    Some engines support localization, for these engines, there is a predefined key "lang" to specify the language to be used in the localization, the format should follow the standard locale formats e.g.: "en-gb", "pt-br", "en".

    Parameters

    • context: {}
      • [key: string]: any
    • templateFileName: string

    Returns PromiseLike<Buffer>

  • Render the template. Template engines that support partials/fragments should extract the template base path from the template filename up to the last file separator.

    Some engines support localization, for these engines, there is a predefined key "lang" to specify the language to be used in the localization, the format should follow the standard locale formats e.g.: "en-gb", "pt-br", "en".

    Parameters

    • context: {}
      • [key: string]: any
    • templateFileName: string
    • handler: ((res: AsyncResult<Buffer>) => void) | Handler<AsyncResult<Buffer>>

    Returns void

unwrap

  • unwrap<T>(): T
  • Returns the underlying engine, so further configurations or customizations may be applied.

    Type parameters

    • T

    Returns T

Generated using TypeDoc