Function versionValidatorMiddleware

  • A middleware that will validate a version request parameter against the application version, and generate an error if they don't match. This is a "middleware/controller" because the wrappers for both are the same, the difference is that, for controllers, Jimpex sends a second parameter with the route where they are mounted. By validating the route parameter, the function can know whether the implementation is going to use the middleware by itself or as a route middleware. If used as middleware, it will just return the result of VersionValidator.getMiddleware; but if used as controller, it will mount it on [route]/:version/*.

    Parameters

    Returns Resource<"middleware", "connect", MiddlewareConnectFn>

Properties

Properties

middleware: true

Generated using TypeDoc