Using sxzz/ts-starter as the starter template
Features:
- Maintains the original client request method of
hono
- Preserves type-safe hono rpc calling style
- Uses
alova
as the request library - Supports all request strategy features of
alova
pnpm add hono-alovajs-client
import { createAlova } from 'alova'
import adapterFetch from 'alova/fetch'
import { hac } from 'hono-alovajs-client'
import type { App } from './server'
const alova = createAlova({
baseURL: 'http://localhost:3000',
requestAdapter: adapterFetch(),
responded: (response) => response.json(),
})
const client = hac<App>(alova)
const users = await client.users.$alova.$get()
- To maintain compatibility with
hono
, currently only supportsalova
'sfetch
adapter or customfetch
adapter - Request methods like
Get
|Post
|Put
|Delete
|Head
|Options
|Patch
are provided byalova
, while other methods likeurl
are provided natively byhono