diff options
-rw-r--r-- | examples/hono/package.json | 14 | ||||
-rw-r--r-- | examples/hono/readme.md | 17 | ||||
-rw-r--r-- | examples/hono/src/index.ts | 16 | ||||
-rw-r--r-- | examples/hono/tsconfig.json | 10 |
4 files changed, 57 insertions, 0 deletions
diff --git a/examples/hono/package.json b/examples/hono/package.json new file mode 100644 index 000000000..10b123864 --- /dev/null +++ b/examples/hono/package.json @@ -0,0 +1,14 @@ +{ + "version": "1.0.0", + "name": "hono", + "main": "src/index.js", + "devDependencies": { + "bun-types": "^0.0.83" + }, + "dependencies": { + "hono": "^1.6.4" + }, + "scripts": { + "start": "bun run src/index.ts" + } +} diff --git a/examples/hono/readme.md b/examples/hono/readme.md new file mode 100644 index 000000000..992ca277e --- /dev/null +++ b/examples/hono/readme.md @@ -0,0 +1,17 @@ +# Hono with Bun runtime + +## Getting Started + +### Cloning the repo + +```sh +bun create hono ./NAME_HERE +``` + +### Development +``` +bun run start +``` + +Open http://localhost:3000 with your browser to see the result. + diff --git a/examples/hono/src/index.ts b/examples/hono/src/index.ts new file mode 100644 index 000000000..2bc0be21c --- /dev/null +++ b/examples/hono/src/index.ts @@ -0,0 +1,16 @@ +import { Hono } from "hono"; + +const app = new Hono(); + +const port = process.env.PORT || 3000; + +const home = app.get("/", (c) => { + return c.json({ message: "Hello World!" }); +}); + +console.log(`Running at http://localhost:${port}`); + +export default { + port: process.env.PORT || 3000, + fetch: home.fetch, +}; diff --git a/examples/hono/tsconfig.json b/examples/hono/tsconfig.json new file mode 100644 index 000000000..a3d4e525d --- /dev/null +++ b/examples/hono/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "lib": ["ESNext"], + "module": "esnext", + "target": "esnext", + "moduleResolution": "node", + // "bun-types" is the important part + "types": ["bun-types"] + } + }
\ No newline at end of file |