Add support for bun router
What is the feature you are proposing?
Hono works great out of the box with Bun using the existing routers.
Now that Bun has stable support for its native HTTP router, is there any plan to support or integrate Bun's router when the runtime is Bun?
More info: https://bun.com/docs/api/http#routing
it could be implemented but would need a workaround because native http router need a Response or a function that it can invoke. and if you are building natively you would need to add each controller by yourself. to support Bun router we can do is to expose a method to users like - app.BunRoute("METHOD", "PATH", Handler ) and in core hono class we would need to generate each functions dynamically then bun's http router works.
for playing around it , use diese.js which is also a framework and has support of bun's native http router. check - https://github.com/pradeepbgs/diesel/blob/main/example/bun/app.ts line no 395 - https://github.com/pradeepbgs/diesel/blob/main/src/main.ts
@yusukebe can i workaround this to support native bun http router?
We never add features that depend on runtime-specific functions.
@yusukebe can this functionality exist as an adapter? or a standalone package which can be passed to hono somehow?
@thelovekesh
I think it will be a good idea to create an independent router outside of this hono package. Like this:
import { Hono } from 'hono'
import { BunRouter } from '@hono/bun-router'
const app = new Hono({
router: new BunRouter()
})
But I don't know if a router with Bun features will be fast enough.