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

Add environment variable handling to Hono example #557

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/framework-hono/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Inngest Hono Template

This is a [Hono](https://hono.dev/) v4 project targetting Cloudflare Workers. It is a reference on how to send and receive events with Inngest and Hono.
This is a [Hono](https://hono.dev/) v4 project targeting Cloudflare Workers. It is a reference on how to send and receive events with Inngest and Hono.

## Getting Started

Expand Down
23 changes: 12 additions & 11 deletions examples/framework-hono/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"scripts": {
"dev": "wrangler dev --port 3000 src/index.ts",
"deploy": "wrangler deploy --minify src/index.ts"
},
"dependencies": {
"hono": "^4.2.7"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240403.0",
"wrangler": "^3.47.0"
}
"scripts": {
"dev": "wrangler dev --port 3000 src/index.ts",
"deploy": "wrangler deploy --minify src/index.ts"
},
"dependencies": {
"hono": "^4.2.8",
"inngest": "^3.19.0"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240423.0",
"wrangler": "^3.52.0"
}
}
22 changes: 13 additions & 9 deletions examples/framework-hono/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ import { Hono } from "hono";
import { serve } from "inngest/hono";
import { functions, inngest } from "./inngest";

const app = new Hono();
export type Env = {
INNGEST_SIGNING_KEY?: string;
};

app.on(
["GET", "PUT", "POST"],
"/api/inngest",
serve({
client: inngest,
functions,
})
);
const app = new Hono<{ Bindings: Env }>();

app.on(["GET", "PUT", "POST"], "/api/inngest", (c) => {
const handler = serve({
client: inngest,
functions,
signingKey: c.env.INNGEST_SIGNING_KEY,
});
return handler(c);
});

export default app;
6 changes: 3 additions & 3 deletions examples/framework-hono/wrangler.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name = "framework-hono"
compatibility_date = "2023-12-01"
compatibility_date = "2024-04-28"

# [vars]
# MY_VAR = "my-variable"
# INNGEST_SIGNING_KEY = "my-variable"

# [[kv_namespaces]]
# binding = "MY_KV_NAMESPACE"
Expand All @@ -18,4 +18,4 @@ compatibility_date = "2023-12-01"
# database_id = ""

# [ai]
# binding = "AI"
# binding = "AI"