import 'core-js/library' ; import { Logger , LoggerFactory } from './common' ; import { Express , Router } from 'express' ; import { AppConfig } from './config' ; import { AppDataServices } from './data' ; import { ExpressAppFactory } from './express-app-factory' ; import { ApiRouterFactory } from './api' ; import { RestErrorMiddleware } from './common' ; const LOGGER = LoggerFactory . getLogger ( ) ; const appConfig = new AppConfig ( process . env ) ; const appServices = new AppDataServices ( ) ; const apiRouter = ApiRouterFactory . getApiRouter ( appServices ) ; const errorMiddleware = [ RestErrorMiddleware . normalizeToRestError , RestErrorMiddleware . serializeRestError ] ; const app = ExpressAppFactory . getExpressApp ( appConfig , apiRouter , null , errorMiddleware ) ; app . listen ( appConfig . port , ( ) => { LOGGER . info ( `Express server listening on port ${ appConfig . port }` ) ; } ) ;