Skip to content
Back to Changelog

Use native request and response objects in Appwrite Functions

Function runtimes now pass their web server's request to your code as context.req.raw. It's a Fetch API Request in Node.js 18 and later, Bun, and Deno, an aiohttp web.Request in Python, a shelf Request in Dart, and the server's own request type in every other runtime. Node.js 18 and later, Bun, Deno, Python, and Dart functions can also return a native response instead of calling a context.res method. The deprecated node-14.5, node-16.0, dart-2.15, and swift-5.5 runtimes support neither.

JavaScript
export default async ({ req }) => {
const form = await req.raw.formData();
return new Response(`Hello, ${form.get('name')}!`);
};

Frameworks built on the Fetch API, such as Hono, run in a JavaScript function too: pass req.raw to the app and return the response it gives back. Existing functions keep working without changes.