Class VersionValidator

This is the handler for the middleware/controller that validates the application version. This is useful in cases where you want to restrict the access to specific versions; for example: you have a frontend which needs to be aligned with the "current" version of the application, since the frontend won't realize a new version was released, the validator can be used to let the frontend know. Also, it can be configured to handle requests from popups, in which case, instead of generating an error message, it will send a post message.

Prettierignore

Constructors

Properties

_HTTPError: typeof HTTPError

To generate the errors in case the validation fails.

The customization options.

_responsesBuilder: ResponsesBuilder

To generate responses for popups.

_statuses: Statuses

The uility service to get HTTP status codes.

Accessors

Methods

  • Helper method that checks if the incoming request is from a popup. It will look for the query string variable defined in the constructor options.

    Parameters

    • req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

      The request object sent by the application.

    Returns boolean

  • Helper method that checks if the "latest version" is enabled and if the given version is "the latest" (comparing it with the option name).

    Parameters

    • version: string

      The version received in the request.

    Returns boolean

Generated using TypeDoc