JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 456299
  • Score
    100M100P100Q194379F
  • License MIT

Validator middleware using Zod

Package Exports

  • @hono/zod-validator
  • @hono/zod-validator/dist/cjs/index.js
  • @hono/zod-validator/dist/esm/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@hono/zod-validator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Zod validator middleware for Hono

WIP

The validator middleware using Zod for Hono applications. You can write a schema with Zod and validate the incoming values.

Usage

import { z } from 'zod'
import { zValidator } from '../src'

const schema = z.object({
  name: z.string(),
  age: z.number(),
})

app.post('/author', zValidator('json', schema), (c) => {
  const data = c.req.valid()
  return c.json({
    success: true,
    message: `${data.name} is ${data.age}`,
  })
})

Author

Yusuke Wada https://github.com/yusukebe

License

MIT