Class ShowHTML

A very simple middleware service to send an HTML on a server response. The special 'feature' of this service is that it can be hooked up to an HTMLGenerator service and it will automatically server the file generated by it.

Prettierignore

Constructors

Properties

_fileReady: boolean = false

Whether or not the file is ready to be served. In case the middleware uses an HTMLGenerator service, the file needs to be generated before being available, and that's why this flag exists.

_getHTMLGenerator: (() => undefined | HTMLGenerator)

A function to get a possible HTMLGenerator. This is injected as a "getter" to not interrupt the DIC "lifecycle": middlewares are initialized right when the app starts, and injecting a reference would force the service to be initialized too, even if a request is not being made.

Type declaration

_options: ShowHTMLOptions

The customization options for the middleware.

_sendFile: SendFile

The service that serves a file.

Accessors

Methods

  • Serves the HTML file to the response.

    Parameters

    • res: Response<any, Record<string, any>>

      The response object generated by the application.

    • next: NextFunction

      The function to call the next middleware.

    Returns void

Generated using TypeDoc