Class ViewEngineAbstract

Abstract base class for rendering views via different view engines.

Hierarchy

Constructors

Properties

config: Config
debug: boolean
globals: {
    [key: string]: ((req: Maybe<Request>) => any);
} = {}

Type declaration

namespaces: {
    [key: string]: UniversalPath;
} = {}

Type declaration

routing: Routing

Accessors

Methods

  • Get the method with the given name from this class, bound to this class.

    Returns

    function

    Parameters

    • methodName: string

    Returns ((...args: any[]) => any)

      • (...args: any[]): any
      • Get the method with the given name from this class, bound to this class.

        Returns

        function

        Parameters

        • Rest ...args: any[]

        Returns any

  • Get the file extension of template files of this engine.

    Example

    .pug

    Returns string

  • Protected

    Get the global variables that should be passed to every view rendered.

    Returns {
        [key: string]: any;
    }

    • [key: string]: any
  • Call the make() method on the global container.

    Type Parameters

    • T

    Parameters

    • target: any
    • Rest ...parameters: any[]

    Returns T

  • Given the canonical name of a template file, render the file using the provided variables.

    Parameters

    • templateName: string
    • locals: {
          [key: string]: any;
      }
      • [key: string]: any

    Returns string | Promise<string>

  • Given a template string and a set of variables for the view, render the string to HTML and return it.

    Parameters

    • templateString: string
    • locals: {
          [key: string]: any;
      }
      • [key: string]: any

    Returns string | Promise<string>