INNER CODE UNIT · TypeScript

createServer

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

const createServer = async (): Promise<http.Server | https.Server> => {
  if (env.HTTPS) {
    https.globalAgent.maxSockets = Infinity
    const [privateKey, certificate] = await Promise.all([
      fs.readFile(env.PRIVATE_KEY, 'utf8'),
      fs.readFile(env.CERTIFICATE, 'utf8'),
    ])
    const credentials: ServerOptions = { key: privateKey, cert: certificate }
    return https.createServer(credentials, app)
  }

  http.globalAgent.maxSockets = Infinity
  return http.createServer(app)
}

/**
 * Shutdown timeout duration in milliseconds.
 * If server shutdown takes longer than this, the process will be forcefully exited.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…