/Knowledge/sources/honojs__hono/llms-full/rpc-url--d3c1d2f91359.md

RPC: $url() - hono-docs

RPC: $url() Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt url Summary You can get a URL object for a...

RPC: $url()

Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#url

Summary

You can get a URL object for accessing the endpoint by using $url(). ::: warning You have to pass in an absolute URL for this to work. Passing in a relative URL / will result in the following error. `Uncaught TypeError: Failed to c...

Content

You can get a URL object for accessing the endpoint by using $url().

::: warning You have to pass in an absolute URL for this to work. Passing in a relative URL / will result in the following error.

Uncaught TypeError: Failed to construct 'URL': Invalid URL

// ❌ Will throw error
const client = hc<AppType>('/')
client.api.post.$url()

// ✅ Will work as expected
const client = hc<AppType>('http://localhost:8787/')
client.api.post.$url()

:::

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 url = client.api.posts.$url()
console.log(url.pathname) // `/api/posts`

url = client.api.posts[':id'].$url({
  param: {
    id: '123',
  },
})
console.log(url.pathname) // `/api/posts/123`

Metadata

{
  "chunk_index": 0,
  "citation": "https://hono.dev/llms-full.txt#url",
  "coverage_role": "overview",
  "qualified_title": "Hono / llms-full / RPC > `$url()`",
  "retrieved_at": "2026-07-02T05:51:01Z",
  "section_index": 58,
  "source_id": "/honojs/hono",
  "source_type": "llms_full",
  "target_label": "llms-full",
  "title": "RPC: $url()",
  "upstream_url": "https://hono.dev/llms-full.txt",
  "version": "2026"
}
Kinic Wiki
Loading knowledge node
Details

Identity

database
db_23dhmsxlhukv
database_id
db_23dhmsxlhukv
path
/Knowledge/sources/honojs__hono/llms-full/rpc-url--d3c1d2f91359.md
kind
directory
role
markdown_note
children
0

Metadata

created_at
virtual
updated_at
virtual
etag
virtual
metadata_json
{}

Lint Hints

No lightweight warnings.

Outgoing Links

No outgoing links indexed.

Incoming Links

Select a file node to inspect backlinks.

Raw Source

No raw source path inferred.