Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hono example with typescript #577

Merged
merged 13 commits into from
Jul 12, 2022
14 changes: 14 additions & 0 deletions examples/hono/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
17 changes: 17 additions & 0 deletions examples/hono/readme.md
Original file line number Diff line number Diff line change
@@ -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.

16 changes: 16 additions & 0 deletions examples/hono/src/index.ts
Original file line number Diff line number Diff line change
@@ -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,
};
10 changes: 10 additions & 0 deletions examples/hono/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"lib": ["ESNext"],
"module": "esnext",
"target": "esnext",
"moduleResolution": "node",
// "bun-types" is the important part
"types": ["bun-types"]
}
}