Skip to content

Commit 5216df6

Browse files
authored
Merge pull request #12 from kc3hack/setup-do
2 parents 312323e + 7ced70c commit 5216df6

File tree

6 files changed

+10927
-3
lines changed

6 files changed

+10927
-3
lines changed

apps/web/src/app.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// TODO: 後で new Hono しているところを new Hono<WorkerEnv>() にする。
2+
// 現時点で Worker の Bindigns を利用するハンドラーがないが、
3+
// 将来的に利用するだろうから Hono インスタンスの作成は Factory パターンにしておきたい。
4+
export type WorkerEnv = {
5+
Env: Cloudflare.Env;
6+
Bindings: CloudflareBindings;
7+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { DurableObject } from "cloudflare:workers";
2+
import type { WorkerEnv } from "@/app";
3+
4+
export class DoorMan extends DurableObject<WorkerEnv["Env"]> {}

apps/web/src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import app from "@/pages";
22

3+
export { DoorMan } from "@/durable-objects/DoorMan";
34
export default app;

0 commit comments

Comments
 (0)