Writing and deploying
Code is a Deno module - standardfetch/Response, ESM imports, no bundler:
$NEXT_PUBLIC_BACKEND_URL/functions/my-function.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Serverless Deno functions: invoke from the app, deploy from the terminal.
const { data, error } = await backend.functions.invoke("my-function", {
method: "POST",
body: { orderId },
});
fetch/Response, ESM imports, no bundler:
// fn.ts
export default async function (req: Request) {
const { orderId } = await req.json();
return new Response(JSON.stringify({ ok: true, orderId }), {
headers: { "Content-Type": "application/json" },
});
}
npx @resultdev/cli functions deploy my-function --file fn.ts
$NEXT_PUBLIC_BACKEND_URL/functions/my-function.
npx @resultdev/cli secrets set OPENWEATHER_KEY=...
// inside the function
const key = Deno.env.get("OPENWEATHER_KEY");