mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
41 lines
997 B
TypeScript
Executable File
41 lines
997 B
TypeScript
Executable File
import App from 'CommonServer/Utils/StartServer';
|
|
import path from 'path';
|
|
import Express, {
|
|
ExpressApplication,
|
|
ExpressRequest,
|
|
ExpressResponse,
|
|
ExpressStatic,
|
|
} from 'CommonServer/Utils/Express';
|
|
import logger from 'CommonServer/Utils/Logger';
|
|
|
|
export const APP_NAME: string = 'accounts';
|
|
|
|
const app: ExpressApplication = Express.getExpressApp();
|
|
|
|
app.use(ExpressStatic(path.join(__dirname, 'public')));
|
|
|
|
app.use(`/${APP_NAME}`, ExpressStatic(path.join(__dirname, 'public')));
|
|
|
|
app.use(
|
|
[`/${APP_NAME}/assets`, `/${APP_NAME}/${APP_NAME}/assets`],
|
|
ExpressStatic(path.join(__dirname, 'dist'))
|
|
);
|
|
|
|
app.get('/*', (_req: ExpressRequest, res: ExpressResponse) => {
|
|
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
|
});
|
|
|
|
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();
|
|
|
|
export default app;
|