mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-23 07:42:10 +00:00
33 lines
900 B
TypeScript
33 lines
900 B
TypeScript
import Express, { ExpressApplication } from 'CommonServer/Utils/Express';
|
|
import App from 'CommonServer/Utils/StartServer';
|
|
import { PostgresAppInstance } from 'CommonServer/Infrastructure/PostgresDatabase';
|
|
import logger from 'CommonServer/Utils/Logger';
|
|
import LinkShortenerAPI from './API/LinkShortener';
|
|
|
|
const APP_NAME: string = 'l';
|
|
|
|
const app: ExpressApplication = Express.getExpressApp();
|
|
|
|
app.use([`/${APP_NAME}/`, '/'], LinkShortenerAPI);
|
|
|
|
const init: () => Promise<void> = async (): Promise<void> => {
|
|
try {
|
|
// connect to the database.
|
|
await PostgresAppInstance.connect(
|
|
PostgresAppInstance.getDatasourceOptions()
|
|
);
|
|
|
|
// init the app
|
|
await App(APP_NAME);
|
|
} catch (err) {
|
|
logger.error('App Init Failed:');
|
|
logger.error(err);
|
|
}
|
|
};
|
|
|
|
init().catch((err: Error) => {
|
|
logger.error(err);
|
|
});
|
|
|
|
export default app;
|