INNER CODE UNIT · TypeScript

start

aelassas/movinin · backend/src/index.ts:42

const start = async (): Promise<void> => {
  try {
    const connected = await databaseHelper.connect(env.DB_URI, env.DB_SSL, env.DB_DEBUG)
    const initialized = await databaseHelper.initialize()

    if (!connected || !initialized) {
      logger.error('Failed to connect or initialize the database')
      process.exit(1)
    }

    const protocol = env.HTTPS ? 'HTTPS' : 'HTTP'
    const server = await createServer()

    server.listen(env.PORT, () => {
      logger.info(`${protocol} server is running on port ${env.PORT}`)
    })

    const shutdown = async (signal: string): Promise<void> => {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…