usin "appwrite": "^10.0.1"
server sdk looks:
import { Client } from 'node-appwrite';
import { fetch } from 'undici';
export default async ({ req, res, log, error }) => {
// If something goes wrong, log an error
error('Hello, Errors!');
if (req.path === '/eur') {
const amountInEuros = Number(req.query.amount);
const response = await fetch('https://api.exchangerate.host/latest?base=EUR&symbols=USD');
const data = await response.json();
const amountInDollars = amountInEuros * data.rates.USD;
return res.send(amountInDollars.toString());
}
if (req.path === '/inr') {
const amountInRupees = Number(req.query.amount);
const response = await fetch('https://api.exchangerate.host/latest?base=INR&symbols=USD');
const data = await response.json();
const amountInDollars = amountInRupees * data.rates.USD;
return res.send(amountInDollars.toString());
}
return res.send('Invalid path');
};
Mouse over createExecution. What do you see?
That's weird and confusing...that's for the code in the same folder as the package.json that says 10.0.1?
Yes
For some reason, your IDE isn't picking up the right types.
This version is old. Please upgrade
Which Version should work
Always read the readme to see what version of Appwrite the SDK version is for
Recommended threads
- Need help with createExecution function
Hi, Need some help understanding createExecution. When requesting function execution via createExecution, the function handler arguments are incorrect and rese...
- HTTP POST to function returning "No Appw...
Hi everyone, I’m running into an issue with my self-hosted Appwrite instance. I’ve set up my environment variables (APPWRITE_FUNCTION_PROJECT_ID, APPWRITE_FUNC...
- Can't add dart 3.5 runtime
Modified the `.env` to enable dart 3.5 runtime on my self-hosted instance but still can't find the runtime when creating a new function. I manually pulled the i...