Web Developer
Taking this example on how to build a Function in JS from the docs:
export default async ({ req, res, log }) => {
switch (req.query.type) { case 'empty': return res.empty(); case 'json': return res.json({"type": "This is a JSON response"}); case 'redirect': return res.redirect("https://appwrite.io", 301); case 'html': return res.send( "<h1>This is an HTML response</h1>", 200, { "content-type": "text/html" }); default: return res.send("This is a text response"); }}I wonder if there's some documentation on the typing of req, res and log? Or even better a dependency I can pull in for it... I actually develop in TypeScript and use Bun for execution, and not having any typing is hard. E.g. can I pass a status code to res.json()? Which parameter would it be? Will it always be the second one? Can I always send headers on the third parameter? What's the fourth parameter?