"use strict" ; import "reflect-metadata" ; import { Application } from "./app" ; import { Server } from "./server" ; import { Socket } from "./common/socket-util" ; import { Log } from "./common/log" ; const LOGGER = Log . getLogger ( "main" ) ; let app = new Application ( ) ; let server = new Server ( app . httpHandler ) ; let shuttingDown = false ; process . on ( "SIGINT" , ( ) => { if ( shuttingDown ) { LOGGER . info ( "shutting down..." ) ; return ; } shuttingDown = true ; app . close ( ) . then ( ( ) => { server . close ( ) ; LOGGER . info ( "shut down complete" ) ; process . exit ( ) ; } ) ; } ) ; app . start ( ) . then ( ( ) => { server . init ( ) ; app . initSocket ( server ) ; server . start ( ) ; } ) . then ( null , ( err ) => { LOGGER . error ( err ) ; } ) ;