Get Database

Script appwrite Verified

by adam186 ยท 4/17/2023

The script

Submitted by hugo989 Bun
Verified 1 day ago
1
import { Client, Databases } from "[email protected]";
2

3
type Appwrite = {
4
  endpoint: string;
5
  project: string;
6
  key: string;
7
  self_signed: boolean;
8
};
9
export async function main(auth: Appwrite, id: string) {
10
  const client = new Client()
11
    .setEndpoint(auth.endpoint)
12
    .setProject(auth.project)
13
    .setKey(auth.key);
14
  const db = new Databases(client);
15

16
  return await db.get(id);
17
}
18

Other submissions
  • Submitted by adam186 Deno
    Created 393 days ago
    1
    import { Client, Databases } from "https://deno.land/x/[email protected]/mod.ts";
    2
    
    
    3
    type Appwrite = {
    4
      endpoint: string;
    5
      project: string;
    6
      key: string;
    7
      self_signed: boolean;
    8
    };
    9
    export async function main(auth: Appwrite, id: string) {
    10
      const client = new Client()
    11
        .setEndpoint(auth.endpoint)
    12
        .setProject(auth.project)
    13
        .setKey(auth.key);
    14
      const db = new Databases(client);
    15
    
    
    16
      return await db.get(id);
    17
    }
    18