Initial curated projectbrain source from 8a7b1e0651dbdab97d744cbd2e653ab3970ac6c5
This commit is contained in:
commit
5aa3e8d685
700 files changed
+132801
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { buildApp } from "./app.js";
|
||||
import { loadEnv } from "./config/env.js";
|
||||
|
||||
const env = loadEnv();
|
||||
const app = await buildApp({ env });
|
||||
|
||||
const shutdown = async (signal: string) => {
|
||||
app.log.info({ signal }, "Shutting down ProjectBrain API");
|
||||
await app.close();
|
||||
process.exit(0);
|
||||
};
|
||||
|
||||
process.on("SIGINT", () => {
|
||||
void shutdown("SIGINT");
|
||||
});
|
||||
|
||||
process.on("SIGTERM", () => {
|
||||
void shutdown("SIGTERM");
|
||||
});
|
||||
|
||||
try {
|
||||
await app.listen({ host: env.HOST, port: env.PORT });
|
||||
app.log.info(
|
||||
{ host: env.HOST, port: env.PORT },
|
||||
"ProjectBrain API listening",
|
||||
);
|
||||
} catch (error) {
|
||||
app.log.error(error, "ProjectBrain API failed to start");
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in new issue
Block a user