Created
October 26, 2022 17:32
-
-
Save djfarrelly/815686ec6b837ffebf45456de8f99639 to your computer and use it in GitHub Desktop.
Inngest Cloudflare Workers Support (w/ [email protected])
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createFunction } from "inngest"; // v0.6.1 | |
import { serve } from "inngest/cloudflare"; | |
/** | |
* Inngest serve requires "node_compat = true" to be set in your wrangler.toml | |
* | |
* Set INNGEST_SIGNING_KEY in your wrangler.toml environment variables. | |
* Get this key in your Inngest dashboard: https://app.inngest.com/secrets | |
*/ | |
export interface Env { | |
PRODUCTION: string; | |
INNGEST_SIGNING_KEY: string; | |
} | |
const myFn = createFunction("Hello world", "demo/test.event", ({ event }) => { | |
return "Hello!"; | |
}); | |
export default { | |
async fetch( | |
request: Request, | |
env: Env, | |
ctx: ExecutionContext | |
): Promise<Response> { | |
return serve("My app", [myFn])({ request, env }); | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment