2022-05-24 16:46:21 +00:00
|
|
|
import App from 'CommonServer/Utils/StartServer';
|
2022-05-13 10:50:24 +00:00
|
|
|
import path from 'path';
|
2022-05-25 22:03:45 +00:00
|
|
|
import Express, {
|
|
|
|
ExpressApplication,
|
2022-03-21 22:26:54 +00:00
|
|
|
ExpressRequest,
|
|
|
|
ExpressResponse,
|
2022-03-22 11:19:12 +00:00
|
|
|
ExpressStatic,
|
2022-04-10 21:57:14 +00:00
|
|
|
} from 'CommonServer/Utils/Express';
|
2022-11-10 18:50:20 +00:00
|
|
|
import logger from 'CommonServer/Utils/Logger';
|
2019-09-09 13:30:52 +00:00
|
|
|
|
2022-05-25 22:03:45 +00:00
|
|
|
export const APP_NAME: string = 'accounts';
|
|
|
|
|
|
|
|
const app: ExpressApplication = Express.getExpressApp();
|
|
|
|
|
2022-11-10 19:01:30 +00:00
|
|
|
app.use(ExpressStatic(path.join(__dirname, 'public')));
|
2021-12-30 07:25:15 +00:00
|
|
|
|
2022-11-10 19:01:30 +00:00
|
|
|
app.use(`/${APP_NAME}`, ExpressStatic(path.join(__dirname, 'public')));
|
2021-12-29 13:16:55 +00:00
|
|
|
|
2022-03-22 11:19:12 +00:00
|
|
|
app.get('/*', (_req: ExpressRequest, res: ExpressResponse) => {
|
2022-11-10 18:50:20 +00:00
|
|
|
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
2019-08-02 12:56:16 +00:00
|
|
|
});
|
|
|
|
|
2022-11-10 18:50:20 +00:00
|
|
|
const init: Function = async (): Promise<void> => {
|
|
|
|
try {
|
|
|
|
// init the app
|
|
|
|
await App(APP_NAME);
|
|
|
|
} catch (err) {
|
|
|
|
logger.error('App Init Failed:');
|
|
|
|
logger.error(err);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
init();
|
|
|
|
|
2022-05-13 10:50:24 +00:00
|
|
|
export default app;
|