MCPcopy Create free account
hub / github.com/ThatGuySam/doesitarm / onRequest

Function onRequest

functions/hello-world.js:1–18  ·  view source on GitHub ↗
(context)

Source from the content-addressed store, hash-verified

1export async function onRequest(context) {
2 // Contents of context object
3 const {
4 request, // same as existing Worker API
5 env, // same as existing Worker API
6 params, // if filename includes [id] or [[path]]
7 waitUntil, // same as ctx.waitUntil in existing Worker API
8 next, // used for middleware or to fetch assets
9 data, // arbitrary space for passing data between middlewares
10 } = context;
11
12 return new Response(
13 JSON.stringify({
14 message: 'Hello, worker!',
15 context,
16 })
17 )
18}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected