Integrations
Hono can be used in place of the component registerRoutes()
method. Check out the Convex w/ Hono Stack article and the Better Auth Hono docs for more details.
import { Hono } from "hono";import { HonoWithConvex, HttpRouterWithHono } from "convex-helpers/server/hono";import { ActionCtx } from "./_generated/server";import { createAuth } from "./auth";
const app: HonoWithConvex<ActionCtx> = new Hono();
app.use( "/api/auth/*", cors({ origin: "http://localhost:5173", allowHeaders: ["Content-Type", "Authorization", "Better-Auth-Cookie"], allowMethods: ["GET", "POST", "OPTIONS"], exposeHeaders: ["Content-Length", "Set-Better-Auth-Cookie"], maxAge: 600, credentials: true, }));
// Redirect root well-known to api well-knownapp.get("/.well-known/openid-configuration", async (c) => { return c.redirect('/api/auth/convex/.well-known/openid-configuration');});
app.on(["POST", "GET"], "/api/auth/*", async (c) => { const auth = createAuth(c.env); return auth.handler(c.req.raw);});
const http = new HttpRouterWithHono(app);
export default http;
import { Hono } from "hono";import { HonoWithConvex, HttpRouterWithHono } from "convex-helpers/server/hono";import { ActionCtx } from "./_generated/server";import { createAuth } from "./auth";
const app: HonoWithConvex<ActionCtx> = new Hono();
// Redirect root well-known to api well-knownapp.get("/.well-known/openid-configuration", async (c) => { return c.redirect('/api/auth/convex/.well-known/openid-configuration');});
app.on(["POST", "GET"], "/api/auth/*", async (c) => { const auth = createAuth(c.env); return auth.handler(c.req.raw);});
const http = new HttpRouterWithHono(app);
export default http;
import { Hono } from "hono";import { HonoWithConvex, HttpRouterWithHono } from "convex-helpers/server/hono";import { ActionCtx } from "./_generated/server";import { createAuth } from "./auth";
const app: HonoWithConvex<ActionCtx> = new Hono();
// Redirect root well-known to api well-knownapp.get("/.well-known/openid-configuration", async (c) => { return c.redirect('/api/auth/convex/.well-known/openid-configuration');});
app.on(["POST", "GET"], "/api/auth/*", async (c) => { const auth = createAuth(c.env); return auth.handler(c.req.raw);});
const http = new HttpRouterWithHono(app);
export default http;