Initial commit (unpacked platform)
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { loadConfig } from "./config.js";
|
||||
import { buildServer } from "./server.js";
|
||||
|
||||
const config = loadConfig();
|
||||
const app = await buildServer(config);
|
||||
|
||||
const shutdown = async (signal: string) => {
|
||||
app.log.info(`${signal} mottagen – stänger ner API:t.`);
|
||||
await app.close();
|
||||
process.exit(0);
|
||||
};
|
||||
process.on("SIGTERM", () => void shutdown("SIGTERM"));
|
||||
process.on("SIGINT", () => void shutdown("SIGINT"));
|
||||
|
||||
try {
|
||||
await app.listen({ port: config.API_PORT, host: "0.0.0.0" });
|
||||
app.log.info(`API igång på :${config.API_PORT} (${config.NODE_ENV}, AAMOS=${config.AAMOS_MODE})`);
|
||||
} catch (err) {
|
||||
app.log.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user