2022-05-24 16:46:21 +00:00
|
|
|
import App from 'CommonServer/Utils/StartServer';
|
2022-12-29 15:50:53 +00:00
|
|
|
import Express, { ExpressApplication } from 'CommonServer/Utils/Express';
|
2022-11-10 18:50:20 +00:00
|
|
|
import logger from 'CommonServer/Utils/Logger';
|
2022-12-10 14:30:39 +00:00
|
|
|
import { PostgresAppInstance } from 'CommonServer/Infrastructure/PostgresDatabase';
|
2022-12-08 08:38:08 +00:00
|
|
|
export const APP_NAME: string = 'status-page';
|
2022-05-25 22:03:45 +00:00
|
|
|
|
|
|
|
const app: ExpressApplication = Express.getExpressApp();
|
|
|
|
|
2023-08-10 17:25:15 +00:00
|
|
|
const init: () => Promise<void> = async (): Promise<void> => {
|
2022-11-10 18:50:20 +00:00
|
|
|
try {
|
|
|
|
// init the app
|
2022-12-29 17:14:29 +00:00
|
|
|
await App(APP_NAME, undefined, true);
|
2022-12-10 14:30:39 +00:00
|
|
|
|
|
|
|
// connect to the database.
|
|
|
|
await PostgresAppInstance.connect(
|
|
|
|
PostgresAppInstance.getDatasourceOptions()
|
|
|
|
);
|
2022-11-10 18:50:20 +00:00
|
|
|
} catch (err) {
|
|
|
|
logger.error('App Init Failed:');
|
|
|
|
logger.error(err);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-08-10 18:00:27 +00:00
|
|
|
init().catch((err: Error) => {
|
|
|
|
logger.error(err);
|
|
|
|
});
|
2022-11-10 18:50:20 +00:00
|
|
|
|
2022-05-13 10:50:24 +00:00
|
|
|
export default app;
|