import express from 'express' ; import bodyParser from 'body-parser' ; import cors from 'cors' ; import expressStatusMonitor from 'express-status-monitor' ; import { graphql } from './services/graphql' ; import CONFIG from './config' ; import './services/logger' ; import connectDB from './services/mongoose' ; import { Log } from './services/logger' ; const main = async ( ) => { await connectDB ( ) ; const server = express ( ) ; if ( process . env . EXPRESS_STATUS === 'true' ) { server . use ( expressStatusMonitor ( ) ) ; } server . use ( cors ( ) ) ; server . use ( bodyParser . json ( ) ) ; graphql . applyMiddleware ( { app : server , path : CONFIG . GRAPHQL_PATH } ) ; server . listen ( { port : CONFIG . PORT } , ( ) => { Log . warn ( `🚀  Bundestag.io Server ready at http://localhost:${ CONFIG . PORT }${ CONFIG . GRAPHQL_PATH }` ) ; } ) ; } ; ( async ( ) => { try { await main ( ) ; } catch ( error ) { console . error ( error . stack ) ; } } ) ( ) ;