Hono
HonoΒ is a small, fast web framework that runs everywhere β Node, Bun, Cloudflare Workers, Deno, edge runtimes. With typia you get one-line request validation that doesnβt ship class-validator or a schema library to the edge.
The integration is @hono/typia-validator. You pass it a createValidate factory result and Hono runs the validator before your handler:
import { Hono } from "hono";
import { typiaValidator } from "@hono/typia-validator";
import typia, { type tags } from "typia";
import { IBbsArticle } from "../structures/IBbsArticle";
// build a reusable validator from the type
const validate = typia.createValidate<IBbsArticle>();
const app = new Hono();
app.post("/",
typiaValidator("json", validate),
(c) => {
const data = c.req.valid("json"); // typed as IBbsArticle
return c.json({
id: data.id,
title: data.title,
body: data.body,
created_at: data.created_at,
});
});
export default app;Thatβs it. Hono parses the request body, the validator checks it against IBbsArticle (including any tags.Format/tags.MinLength/etc. you attached to the type), and c.req.valid("json") returns the typed value on success.
@hono/typia-validator works for "json", "form", "query", "param", and "header" targets β anywhere Hono accepts a validator.
Where to go next
- The underlying validator β
validate - Tags for constraints (lengths, formats, ranges) β Special Tags
- Hono docs β hono.devΒ
Last updated on