mirror of
https://github.com/LukeHagar/appwrite-starter-function.git
synced 2025-12-09 20:37:46 +00:00
Swap from get and set to raw set
This commit is contained in:
@@ -24,16 +24,10 @@ export default async ({ req, res, log, error }) => {
|
||||
|
||||
// The `req` object contains the request data
|
||||
if (req.method === "GET") {
|
||||
const doc = await databases.getDocument(
|
||||
"metrics",
|
||||
"load",
|
||||
"65ca2e4954a2e5c286d0"
|
||||
);
|
||||
log(doc["count"]);
|
||||
await databases.updateDocument("metrics", "load", "65ca2e4954a2e5c286d0", {
|
||||
count: doc["count"] + 1,
|
||||
await databases.createDocument("load", "node", ID.unique(), {
|
||||
count: 1,
|
||||
});
|
||||
return res.send(`Count Updated`);
|
||||
return res.send(`Created Record`);
|
||||
} else {
|
||||
return res.send(`Invalid request method. Please use GET.`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user