chores(examples/hono): Refine Hono example (#773)

* fixed path

* add favicon

* Correct version: `^2.0.0`

* remove wiptest command
This commit is contained in:
Yusuke Wada
2022-07-25 05:51:41 +09:00
committed by GitHub
parent bdf6b3e312
commit 7896361084
4 changed files with 12 additions and 5 deletions

View File

@@ -11,4 +11,4 @@
"start": "bun run src/index.ts"
},
"module": "src/index.js"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -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/>

View File

@@ -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
};