/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-path-45948703af8c-path-s0060-c0000.md
`$path()` - hono-docs
$path() Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt path Summary $path() is similar to $url()...
$path()
Source evidence: /Sources/raw/honojshono/honojshono.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`