diff options
author | 2022-07-25 05:51:41 +0900 | |
---|---|---|
committer | 2022-07-24 22:51:41 +0200 | |
commit | 78963610848c88106d31d91def27f27d2560ea0c (patch) | |
tree | 703a70deb76daf27f5792385298609e8622e2901 /examples | |
parent | bdf6b3e31211d55532c5f5c01cea228b1d6133ef (diff) | |
download | bun-78963610848c88106d31d91def27f27d2560ea0c.tar.gz bun-78963610848c88106d31d91def27f27d2560ea0c.tar.zst bun-78963610848c88106d31d91def27f27d2560ea0c.zip |
chores(examples/hono): Refine Hono example (#773)
* fixed path
* add favicon
* Correct version: `^2.0.0`
* remove wiptest command
Diffstat (limited to 'examples')
-rw-r--r-- | examples/hono/package.json | 2 | ||||
-rw-r--r-- | examples/hono/public/favicon.ico | bin | 0 -> 15406 bytes | |||
-rw-r--r-- | examples/hono/readme.md | 4 | ||||
-rw-r--r-- | examples/hono/src/index.ts | 9 |
4 files changed, 11 insertions, 4 deletions
diff --git a/examples/hono/package.json b/examples/hono/package.json index 7e99418db..475c1ed39 100644 --- a/examples/hono/package.json +++ b/examples/hono/package.json @@ -11,4 +11,4 @@ "start": "bun run src/index.ts" }, "module": "src/index.js" -} +}
\ No newline at end of file diff --git a/examples/hono/public/favicon.ico b/examples/hono/public/favicon.ico Binary files differnew file mode 100644 index 000000000..543164354 --- /dev/null +++ b/examples/hono/public/favicon.ico diff --git a/examples/hono/readme.md b/examples/hono/readme.md index 992ca277e..20b15e3ea 100644 --- a/examples/hono/readme.md +++ b/examples/hono/readme.md @@ -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/>
\ No newline at end of file diff --git a/examples/hono/src/index.ts b/examples/hono/src/index.ts index 145bd5db0..801955af3 100644 --- a/examples/hono/src/index.ts +++ b/examples/hono/src/index.ts @@ -1,10 +1,13 @@ import { Hono } from "hono"; +import { serveStatic } from 'hono/serve-static.bun'; + +const port = parseInt(process.env.PORT) || 3000; const app = new Hono(); -const port = parseInt(process.env.PORT) || 3000; +app.use('/favicon.ico', serveStatic({ path: './public/favicon.ico' })); -const home = app.get("/", (c) => { +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 }; |