Request Validator (Zod)
The Request Validator component provides a standardized way to validate request data (body, query parameters, and route parameters) in Servercn using Zod schemas.
Installation Guide
npx servercn-cli add request-validatorBasic Implementation
Schema Definition
Create validation schemas using Zod.
Usage Example
Apply the validateRequest middleware to your routes with the appropriate schema.
Validation Error Responses
When validation fails, the handler returns a standardized 400 Bad Request response with detailed error information:
(The exact structure depends on your ApiError implementation.)