Skip to content

SudoSOS Back-end API / internal/middleware / RequestValidatorMiddleware

Class: RequestValidatorMiddleware ​

This class is responsible for:

  • validating request models as middleware.

Constructors ​

Constructor ​

ts
new RequestValidatorMiddleware(specification, validator): RequestValidatorMiddleware;

Creates a new request model validator middleware instance.

Parameters ​

ParameterTypeDescription
specificationSwaggerSpecificationthe swagger specification.
validatorBodyValidatorthe validator properties.

Returns ​

RequestValidatorMiddleware

Methods ​

getMiddleware() ​

ts
getMiddleware(): RequestHandler;

Returns ​

RequestHandler

a middleware handler to be used by express.


handle() ​

ts
handle(
   req, 
   res, 
next): Promise<void>;

Middleware handler for validating request models.

Parameters ​

ParameterTypeDescription
reqRequestWithTokenthe express request to handle.
resResponsethe express response object.
nextFunctionthe express next function to continue processing of the request.

Returns ​

Promise<void>