From 448afc4decf021c24058714cc3016a02135d7f9f Mon Sep 17 00:00:00 2001 From: ngc2207 Date: Fri, 31 Jan 2025 16:54:35 +0800 Subject: [PATCH] feat(appwrite): add function to create admin client with Appwrite configuration --- src/lib/appwrite.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/lib/appwrite.ts diff --git a/src/lib/appwrite.ts b/src/lib/appwrite.ts new file mode 100644 index 0000000..2a3e99e --- /dev/null +++ b/src/lib/appwrite.ts @@ -0,0 +1,14 @@ +import { Account, Client } from "node-appwrite"; + +export async function createAdminClient() { + const client = new Client() + .setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT!) + .setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT!) + .setKey(process.env.NEXT_APPWRITE_KEY!); + + return { + get account() { + return new Account(client); + }, + }; +}