aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGravatar Yusuke Wada <yusuke@kamawada.com> 2022-07-25 05:51:41 +0900
committerGravatar GitHub <noreply@github.com> 2022-07-24 22:51:41 +0200
commit78963610848c88106d31d91def27f27d2560ea0c (patch)
tree703a70deb76daf27f5792385298609e8622e2901 /examples
parentbdf6b3e31211d55532c5f5c01cea228b1d6133ef (diff)
downloadbun-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.json2
-rw-r--r--examples/hono/public/favicon.icobin0 -> 15406 bytes
-rw-r--r--examples/hono/readme.md4
-rw-r--r--examples/hono/src/index.ts9
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
new file mode 100644
index 000000000..543164354
--- /dev/null
+++ b/examples/hono/public/favicon.ico
Binary files differ
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
};