oneuptime/TestServer/Index.ts

28 lines
732 B
TypeScript
Raw Normal View History

2023-05-09 16:03:03 +00:00
import 'ejs';
import Express, { ExpressApplication } from 'CommonServer/Utils/Express';
import logger from 'CommonServer/Utils/Logger';
import App from 'CommonServer/Utils/StartServer';
import MainAPI from './API/Main';
import SettingsAPI from './API/Settings';
const app: ExpressApplication = Express.getExpressApp();
2023-05-09 18:14:09 +00:00
const APP_NAME: string = 'test-server';
2023-05-09 16:03:03 +00:00
app.use([`/${APP_NAME}`, '/'], MainAPI);
app.use([`/${APP_NAME}`, '/'], SettingsAPI);
2023-08-10 17:25:15 +00:00
const init: () => Promise<void> = async (): Promise<void> => {
2023-05-09 16:03:03 +00:00
try {
// init the app
await App(APP_NAME);
} 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);
});