blob: bb492d0df246e934dd86ea3f067722e41e36f7ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import log from "loglevel";
import { server, metricsServer } from "./app";
log.setLevel((Bun.env.LOG_LEVEL || "info") as log.LogLevelDesc);
const metricsServed = Bun.serve(metricsServer);
console.info(`Metrics server started on port ${metricsServed.port}`);
const served = Bun.serve(server);
console.info(`Serving website on http://${served.hostname}:${served.port}/`);
process.on("SIGTERM", function () {
log.info("SIGTERM received, shutting down...");
metricsServed.stop();
served.stop();
});
process.on("SIGINT", function () {
log.info("SIGINT received, shutting down...");
metricsServed.stop();
served.stop();
});
|