English
Learn how to fetch data from your API in your ShipThing application.
apiClient
apps/api
import { apiClient as hc } from 'apps/api/server/api/index'; const res = await hc.api.hello.$get({ query: { name: '' }, });
apps/web
const route = app.get( '/hello', zValidator( 'query', z.object({ name: z.string(), }) ), (c) => { const { name } = c.req.valid('query') return c.json({ message: `Hello! ${name}`, }) } ) export type AppType = typeof route export default handle(app)
import { hc } from 'hono/client'; const res = await hc.api.hello.$get({ query: { name: '' }, });