You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tellme-bot/packages/server/bootstrap.js

41 lines
850 B

3 years ago
import fastify from 'fastify'
import dotenv from 'dotenv'
import path from 'path'
3 years ago
import { EventEmitter } from 'events'
3 years ago
// getting .env
dotenv.config({ path: path.join(path.resolve(), '/../../.env') })
// create server
const server = fastify()
3 years ago
// adding eventEmitter
server.decorate('eventEmitter', new EventEmitter())
3 years ago
3 years ago
// adding xmpp
import xmpp from './plugins/xmpp.js'
server.register(xmpp, {
3 years ago
service: process.env.XMPP_SERVICE,
domain: process.env.XMPP_DOMAIN,
username: process.env.XMPP_USERNAME,
password: process.env.XMPP_PASSWORD
})
/**
* add routes
*
*
*/
import webhookHttp from './http/api/webhook.js'
3 years ago
import healthHttp from './http/api/health.js'
3 years ago
server
.register(webhookHttp, {
'prefix': '/api/webhook'
3 years ago
})
3 years ago
.register(healthHttp, {
'prefix': '/api/health'
})
3 years ago
export default server