import config from 'config';
import {createConnection} from "typeorm";

import {Server} from "./server";
import slack from './slack/slack-bootstrapper';
import ws from './ws/ws-server';

ws.init();

(async () => {
  try {
    await createConnection();
    console.info('DB connected');
  } catch (e) {
    console.error('DB connection failed', e);
  }
})();

export const app = Server.bootstrap().app;
export const server = app.listen(config.get('apiPort'));
