oneuptime/Dashboard/Serve.ts

28 lines
745 B
TypeScript
Raw Normal View History

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';
import { PromiseVoidFunction } from 'Common/Types/FunctionTypes';
2019-09-09 13:30:52 +00:00
2022-12-08 08:38:08 +00:00
export const APP_NAME: string = 'dashboard';
2022-05-25 22:03:45 +00:00
const app: ExpressApplication = Express.getExpressApp();
const init: PromiseVoidFunction = async (): Promise<void> => {
2022-11-10 18:50:20 +00:00
try {
// init the app
2022-12-29 15:50:53 +00:00
await App(APP_NAME, undefined, true);
2022-11-10 18:50:20 +00:00
} catch (err) {
logger.error('App Init Failed:');
logger.error(err);
2023-10-04 18:22:25 +00:00
throw err;
2022-11-10 18:50:20 +00:00
}
};
2023-08-10 18:00:27 +00:00
init().catch((err: Error) => {
logger.error(err);
2023-10-04 18:22:25 +00:00
logger.info('Exiting node process');
2023-09-27 19:48:50 +00:00
process.exit(1);
2023-08-10 18:00:27 +00:00
});
2022-11-10 18:50:20 +00:00
2022-05-13 10:50:24 +00:00
export default app;