Closed ansarizafar closed 2 years ago
Yes, or most are already done! Because Bun has Web standard API such as Request
and Response
like a Cloudflare or Deno. I've tried to run the minimal app using Hono on Bun. It works well! You can run the same script:
https://gist.github.com/yusukebe/0822c1629fc05027dcc8302ddaafc932
Maybe some middleware such as jsx are not working now (Currently, JSX Pragma is not supported on Bun). But, almost are working.
You will be able to start using Hono right away if you want. And the day of support for Bun completely is coming soon.
While attempting to use your demo, I found that if you try to return/res json that it breaks. Very important in my opinion, so it should be looked into. Here is my code: https://gist.github.com/cursecodes/ace9e61658b95aa4dc2d99e4fd6bffbd
Hi @cursecodes
Try to write return
:
app.get("/", (c) => {
return c.json({ message: "Hello Bun!" });
});
Haha yes I was missing that. Unfortunately, this did not fix it.
Hi @cursecodes
This code works well in my environment. I can't reproduce your error.
import { Hono } from 'hono'
const app = new Hono()
app.get('/', (c) => {
return c.json({ message: 'Hello Bun!' })
})
export default {
port: 3000,
fetch: app.fetch,
}
// Run the script on bun
// bun run ./hello.ts
$ bun run --hot src/index.ts error: Cannot find module "hono/dist/hono-base.js" from "C:\Users\PC\Downloads\my-dev\bun-hono-test\my-bun\node_modules\hono\dist\hono.js"
but hono-base.js is available in node-modules
Hi, I got the same problem and I could fix it, following those steps:
Is there any plan for Bunjs support https://bun.sh/