content-type header.
Examples
Return JSON
Respond with JSON, for an API endpoint or for configuration data.
This script returns a fixed JSON object with the right
Last modified on August 17, 2026
Was this page helpful?
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Respond with JSON, for an API endpoint or for configuration data.
content-type header.
import * as BunnySDK from "@bunny.net/edgescript-sdk";
BunnySDK.net.http.serve(
async (request: Request): Response | Promise<Response> => {
const data = {
weather: "sunny",
temperature: 27,
windspeed: 0,
uvindex: 7,
};
const json = JSON.stringify(data);
return new Response(json, {
headers: {
"content-type": "application/json",
},
});
},
);
Was this page helpful?