MCPcopy Index your code
hub / github.com/github/docs / startServer

Function startServer

start-server.js:34–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32}
33
34async function startServer() {
35 const app = createApp()
36
37 // Warm up as soon as possible.
38 // The `warmServer()` function is idempotent and it will soon be used
39 // by some middleware, but there's no point in having a started server
40 // without this warmed up. Besides, by starting this slow thing now,
41 // it can start immediately instead of waiting for the first request
42 // to trigger it to warm up. That way, when in development and triggering
43 // a `nodemon` restart, there's a good chance the warm up has come some
44 // way before you manage to reach for your browser to do a page refresh.
45 await warmServer()
46
47 // Workaround for https://github.com/expressjs/express/issues/1101
48 const server = http.createServer(app)
49
50 return server
51 .listen(port, () => console.log(`app running on http://localhost:${port}`))
52 .on('error', () => server.close())
53}

Callers 1

mainFunction · 0.85

Calls 2

createAppFunction · 0.85
warmServerFunction · 0.85

Tested by

no test coverage detected