skill
unanchored
json-response-with-cors
JS: return JSON Response with CORS headers. Standard CF Worker API pattern.
javascriptcloudflareworkerscorsresponseskill
Body
const jsonR=(d,s=200,x={})=>new Response(JSON.stringify(d),{status:s,headers:{"content-type":"application/json;charset=utf-8","cache-control":"no-store","access-control-allow-origin":"*",...x}});\nconst err=(msg,s=400)=>jsonR({error:msg},s);\nconst corsPreflight=()=>new Response(null,{status:204,headers:{"access-control-allow-origin":"*","access-control-allow-methods":"GET,POST,OPTIONS","access-control-allow-headers":"content-type,x-admin-secret"}});
Provenance
Cryptographic details
| id | reg_sk_json_cors |
| content sha256 | 6f27b03699d85b95bdbb1cd45def5b583366fcd535d99b88839ed3033e6c344f |
Execute via API
POST /api/execute
{ "ref": "reg_sk_json_cors" }
// or by hash prefix:
{ "ref": "6f27b03699d85b95" }
Resolves this artifact by hash — deterministic, provenance-proven. Generation cost is zero when the hash exists.