-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.js
More file actions
34 lines (28 loc) · 825 Bytes
/
server.js
File metadata and controls
34 lines (28 loc) · 825 Bytes
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
import Fastify from 'fastify'
export default function buildServer(config) {
const fastify = Fastify({
logger: {
level: config.LOG_LEVEL,
...(config.PRETTY_PRINT && {
transport: {
target: 'pino-pretty',
},
}),
},
})
fastify.register(import('./plugins/firestore.js'), {
collection: config.FIRESTORE_COLLECTION,
})
fastify.register(import('./plugins/zoom.js'), {
clientId: config.CLIENT_ID,
clientSecret: config.CLIENT_SECRET,
botJid: config.BOT_JID,
secretToken: config.SECRET_TOKEN,
redirectUri: config.REDIRECT_URL,
})
fastify.get('/healthcheck', async () => 'ok')
fastify.register(import('./routes/authorize.js'))
fastify.register(import('./routes/hook.js'))
fastify.register(import('./routes/bot.js'))
return fastify
}