-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
49 lines (43 loc) · 1.33 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"use strict";
const fp = require("fastify-plugin");
const Client = require("./lib/client");
const Users = require("./lib/services/users");
const Account = require("./lib/services/account");
const Database = require("./lib/services/database");
const Teams = require("./lib/services/teams");
const Storage = require("./lib/services/storage");
const Functions = require("./lib/services/storage");
const Health = require("./lib/services/health");
const Avatars = require("./lib/services/avatars");
const Locale = require("./lib/services/locale");
function plugin(fastify, opts, done) {
const client = new Client();
const user = new Users(client);
const account = new Account(client);
const database = new Database(client);
const teams = new Teams(client);
const storage = new Storage(client);
const functions = new Functions(client);
const health = new Health(client);
const avatars = new Avatars(client);
const locale = new Locale(client);
const appwrite = {
client: client,
user: user,
account: account,
database: database,
teams: teams,
storage: storage,
functions: functions,
health: health,
avatars: avatars,
locale: locale,
};
try {
fastify.decorate("appwrite", appwrite);
done();
} catch (error) {
done(error);
}
}
module.exports = fp(plugin, { fastify: "^3.0.0" });