[PR #1317] [MERGED] docs: wrong pattern in hono integration code #20651

Closed
opened 2026-04-15 19:50:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/1317
Author: @MatteoGauthier
Created: 1/30/2025
Status: Merged
Merged: 2/3/2025
Merged by: @Bekacru

Base: mainHead: fix/hono-integration-code


📝 Commits (1)

  • a867b59 docs: wrong pattern in hono integration code

📊 Changes

1 file changed (+2 additions, -2 deletions)

View changed files

📝 docs/content/docs/integrations/hono.mdx (+2 -2)

📄 Description

Caused by c26285b238

The pattern should be * instead of ** since it's not a supported syntax

It is causing strange issue then in the Hono server handlers

Working version

const app = new Hono()

const userRoute = new Hono()
  // .get("/top", (c) => {
  //   return c.json({ message: "Top" }, 200)
  // })
  .get(
    "/:id",
    zValidator(
      "param",
      z.object({
        id: z.string(),
      })
    ),
    (c) => {
      return c.json({ message: `Hello ${c.req.param("id")}` }, 200)
    }
  )

const routes = app.route("/user", userRoute)

app.on(["POST", "GET"], "/api/auth/**", (c) => {
  return c.json({ message: "Hello" }, 200)
})

export default app

// curl http://localhost:3000/api/auth/ok 
// {"message":"Hello"}

Non working version

const userRoute = new Hono()
  .get("/top", (c) => {
    return c.json({ message: "Top" }, 200)
  }) // I've added this 😅😅😅😅
  .get(
    "/:id",
    zValidator(
      "param",
      z.object({
        id: z.string(),
      })
    ),
    (c) => {
      return c.json({ message: `Hello ${c.req.param("id")}` }, 200)
    }
  )

const routes = app.route("/user", userRoute)

app.on(["POST", "GET"], "/api/auth/**", (c) => {
  return c.json({ message: "Hello" }, 200)
})

export default app
// curl http://localhost:3000/api/auth/ok 
// 404 Not Found


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/1317 **Author:** [@MatteoGauthier](https://github.com/MatteoGauthier) **Created:** 1/30/2025 **Status:** ✅ Merged **Merged:** 2/3/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `fix/hono-integration-code` --- ### 📝 Commits (1) - [`a867b59`](https://github.com/better-auth/better-auth/commit/a867b590d82fcf27ac7068f203993ee4e4018c8d) docs: wrong pattern in hono integration code ### 📊 Changes **1 file changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/integrations/hono.mdx` (+2 -2) </details> ### 📄 Description Caused by c26285b238b84215665729f47257b0d6dc9b6aec The pattern should be `*` instead of `**` since it's not a supported syntax It is causing strange issue then in the Hono server handlers **Working version** ```ts const app = new Hono() const userRoute = new Hono() // .get("/top", (c) => { // return c.json({ message: "Top" }, 200) // }) .get( "/:id", zValidator( "param", z.object({ id: z.string(), }) ), (c) => { return c.json({ message: `Hello ${c.req.param("id")}` }, 200) } ) const routes = app.route("/user", userRoute) app.on(["POST", "GET"], "/api/auth/**", (c) => { return c.json({ message: "Hello" }, 200) }) export default app // curl http://localhost:3000/api/auth/ok // {"message":"Hello"} ``` **Non working version** ```tsx const userRoute = new Hono() .get("/top", (c) => { return c.json({ message: "Top" }, 200) }) // I've added this 😅😅😅😅 .get( "/:id", zValidator( "param", z.object({ id: z.string(), }) ), (c) => { return c.json({ message: `Hello ${c.req.param("id")}` }, 200) } ) const routes = app.route("/user", userRoute) app.on(["POST", "GET"], "/api/auth/**", (c) => { return c.json({ message: "Hello" }, 200) }) export default app // curl http://localhost:3000/api/auth/ok // 404 Not Found ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 19:50:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#20651