From 10e167952907bfa7761901817a8b8a5a4f1b989f Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Sun, 27 Feb 2022 14:29:12 -0600 Subject: [PATCH] Add hello world cf function --- functions/hello-world.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 functions/hello-world.js diff --git a/functions/hello-world.js b/functions/hello-world.js new file mode 100644 index 0000000..89cedc9 --- /dev/null +++ b/functions/hello-world.js @@ -0,0 +1,13 @@ +export async function onRequest(context) { + // Contents of context object + const { + request, // same as existing Worker API + env, // same as existing Worker API + params, // if filename includes [id] or [[path]] + waitUntil, // same as ctx.waitUntil in existing Worker API + next, // used for middleware or to fetch assets + data, // arbitrary space for passing data between middlewares + } = context; + + return new Response('Hello, worker!') +}