forked from Lilly-Protocol/lily-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.ts
More file actions
32 lines (27 loc) · 786 Bytes
/
Copy pathserver.ts
File metadata and controls
32 lines (27 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { createServer } from "node:http";
import { createApp } from "./app";
import { registerProcessLifecycle } from "./common/lifecycle/shutdown";
import { buildInfo } from "./config/build-info";
import { env } from "./config/env";
import { logger } from "./config/logger";
const app = createApp();
const server = createServer(app);
server.on("error", (error: NodeJS.ErrnoException) => {
logger.fatal({ err: error, port: env.PORT }, "Failed to start HTTP server");
process.exit(1);
});
server.listen(env.PORT, () => {
logger.info(
{
appName: env.APP_NAME,
environment: env.NODE_ENV,
...buildInfo,
},
"Lily backend server started with resolved configuration",
);
});
registerProcessLifecycle({
server,
logger,
processLike: process,
});