/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-client-eecd389c26e6-client-s0048-c0000.md
Client - hono-docs
Client Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt client Summary On the Client side, import...
Client
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#client
Summary
On the Client side, import hc and AppType first. ts import type { AppType } from '.' import { hc } from 'hono/client' hc is a function to create a client. Pass AppType as Generics and specify the server URL as an argument....
Content
On the Client side, import hc and AppType first.
import type { AppType } from '.'
import { hc } from 'hono/client'hc is a function to create a client. Pass AppType as Generics and specify the server URL as an argument.
const client = hc<AppType>('http://localhost:8787/')Call client.{path}.{method} and pass the data you wish to send to the server as an argument.
const res = await client.posts.$post({
form: {
title: 'Hello',
body: 'Hono is a cool project',
},
})The res is compatible with the "fetch" Response. You can retrieve data from the server with res.json().
if (res.ok) {
const data = await res.json()
console.log(data.message)
}