✅ How to parse form-data as input? #2509
james10424
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
@james10424 , starting v22.12.0 you can use import { defaultEndpointsFactory, ez } from "express-zod-api";
import { z } from "zod";
export const submitFeedbackEndpoint = defaultEndpointsFactory.build({
method: "post",
input: ez.form({
name: z.string().min(1),
email: z.string().email(),
message: z.string().min(1),
}),
}); More details: https://github.com/RobinTail/express-zod-api/blob/master/README.md#html-forms-url-encoded |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How to parse form-data with zod types as input? By default it doesn't seem to parse it unless I have at least one
ez.upload()
in the input field. I worked around it by doing this:Is there a more elegant way of doing this?
Beta Was this translation helpful? Give feedback.
All reactions