/Knowledge/sources/honojs__hono/llms-full/rpc-path--3ee337ec7fea.md
RPC: $path() - hono-docs
RPC: $path() Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt path Summary $path() is similar to $url()...
RPC: $path()
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#path
Summary
$path() is similar to $url(), but returns a path string instead of a URL object. Unlike $url(), it does not include the base URL origin, so it works regardless of the base URL you pass to hc. ```ts const route = app .get('/api/...
Content
$path() is similar to $url(), but returns a path string instead of a URL object. Unlike $url(), it does not include the base URL origin, so it works regardless of the base URL you pass to hc.
const route = app
.get('/api/posts', (c) => c.json({ posts }))
.get('/api/posts/:id', (c) => c.json({ post }))
const client = hc<typeof route>('http://localhost:8787/')
let path = client.api.posts.$path()
console.log(path) // `/api/posts`
path = client.api.posts[':id'].$path({
param: {
id: '123',
},
})
console.log(path) // `/api/posts/123`
You can also pass query parameters:
const path = client.api.posts.$path({
query: {
page: '1',
limit: '10',
},
})
console.log(path) // `/api/posts?page=1&limit=10`
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#path",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / RPC > `$path()`",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 60,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "RPC: $path()",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}