method IValidationService.middleware
IValidationService.middleware(
schema: unknown,
): MiddlewareFunction

Creates middleware that validates one part of the request and stores the parsed value in request state.

Parameters

schema: unknown

The schema (Zod schema by default)

Which request part to validate

Return Type

The validation middleware

Usage

import { type IValidationService } from "common/src/index.ts";