Skip to content

Return JSON

Last reviewed: 7 months ago
Return JSON directly from a Worker script, useful for building APIs and middleware.
export default {
async fetch(request) {
const data = {
hello: "world",
};
return Response.json(data);
},
};
Run Worker in Playground