mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
chores(examples/hono): Refine Hono example (#773)
* fixed path * add favicon * Correct version: `^2.0.0` * remove wiptest command
This commit is contained in:
@@ -11,4 +11,4 @@
|
||||
"start": "bun run src/index.ts"
|
||||
},
|
||||
"module": "src/index.js"
|
||||
}
|
||||
}
|
||||
BIN
examples/hono/public/favicon.ico
Normal file
BIN
examples/hono/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -9,9 +9,13 @@ bun create hono ./NAME_HERE
|
||||
```
|
||||
|
||||
### Development
|
||||
|
||||
```
|
||||
bun run start
|
||||
```
|
||||
|
||||
Open http://localhost:3000 with your browser to see the result.
|
||||
|
||||
### For more information
|
||||
|
||||
See <https://honojs.dev/>
|
||||
@@ -1,10 +1,13 @@
|
||||
import { Hono } from "hono";
|
||||
|
||||
const app = new Hono();
|
||||
import { serveStatic } from 'hono/serve-static.bun';
|
||||
|
||||
const port = parseInt(process.env.PORT) || 3000;
|
||||
|
||||
const home = app.get("/", (c) => {
|
||||
const app = new Hono();
|
||||
|
||||
app.use('/favicon.ico', serveStatic({ path: './public/favicon.ico' }));
|
||||
|
||||
app.get("/", (c) => {
|
||||
return c.json({ message: "Hello World!" });
|
||||
});
|
||||
|
||||
@@ -12,5 +15,5 @@ console.log(`Running at http://localhost:${port}`);
|
||||
|
||||
export default {
|
||||
port,
|
||||
fetch: home.fetch,
|
||||
fetch: app.fetch
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user