JavaScript Examples - Using Args

Check below how to call an argument:

The first example (Code tab) depicts how you can enable the use of args by using event.args.<ARG_CREATED> . The second example (Args tab) represents the use of JSON parameters by internal code functions.

async function handleRequest(request, v) {
return new Response(v, {
headers: new Headers([
["X-Custom-Header", "something defined on JS"],
status: 200,
addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event.request, event.args.value));

"value": "hello_world"