0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-01-06 20:40:08 -05:00
logto/packages/core/src/index.ts
simeng-li baaa58ca0b
refactor(core): per review
add the missing file

refactor: remove unused code

fix(core): rename interactionSie middleware

rename interactionSie middleware

fix(core): update context type name

update context type name

refactor: per review
2022-12-26 19:14:24 +08:00

24 lines
668 B
TypeScript

import { noop } from '@silverhand/essentials';
import Koa from 'koa';
import { configDotEnv } from './env-set/dot-env.js';
import envSet from './env-set/index.js';
import initI18n from './i18n/init.js';
try {
await configDotEnv();
await envSet.load();
const app = new Koa({
proxy: envSet.values.trustProxyHeader,
});
await initI18n();
// Import last until init completed
const { default: initApp } = await import('./app/init.js');
await initApp(app);
} catch (error: unknown) {
console.error('Error while initializing app:');
console.error(error);
await Promise.all([envSet.poolSafe?.end(), envSet.queryClientSafe?.end()]).catch(noop);
}