chanfana
chanfana copied to clipboard
nesting hono routes returns undefined error
Issue
using a route
call on a fromHono
chanfana proxy object returns TypeError: Cannot read properties of undefined (reading 'basePath')
Minimal reproduction code
import { fromHono } from "chanfana";
import { type Context, Hono } from "hono";
const app = new Hono();
const parent = fromHono(app);
const nested = new Hono();
nested.get("/", (c) => c.text("hello, world"));
const child = fromHono(nested);
parent.route("/nested", child);
export default parent;
Expected behavior
nesting chanfana proxies in a route
function should produce the same results as when done in hono - that is, it should group the routes together as sub-routes
Additional Info
Chanfana version: 2.0.4
Relevant stack trace
TypeError: Cannot read properties of undefined (reading 'basePath')
at route (/Users/db/dev/cloudflare/simple/node_modules/hono/dist/cjs/hono-base.js:111:25)
at Proxy.<anonymous> (/Users/db/dev/cloudflare/simple/node_modules/chanfana/dist/index.js:763:50)
the proxy referred to at the trace is located here, and the route call in hono is located here.
there's also currently no documentation in chanfana on how to group hono routes together, only ittyrouter.