feat(appwrite): add function to create admin client with Appwrite configuration

This commit is contained in:
ngc2207 2025-01-31 16:54:35 +08:00
parent 41e21b1149
commit 448afc4dec

14
src/lib/appwrite.ts Normal file
View File

@ -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);
},
};
}