Page MenuHomeSealhub

index.ts
No OneTemporary

index.ts

import kill from "kill-port";
import _locreq from "locreq";
import TheApp from "./app.js";
import { PORT, SEALIOUS_SANITY } from "./config.js";
import { mainRouter } from "./routes/index.js";
import { waitForMeilisearch } from "./services/meilisearch.js";
const locreq = _locreq(new URL("./", import.meta.url).pathname);
export const the_app = new TheApp();
void (async function () {
await kill(PORT);
await kill(PORT);
try {
await waitForMeilisearch(10);
} catch (e) {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
if ((e as Error).message === "timeout") {
console.log("Meilisearch must be running before the app starts!"); // eslint-disable-line no-console
process.exit(1);
} else {
throw e;
}
}
try {
the_app.HTTPServer.addStaticRoute("/", locreq.resolve("public"));
await the_app.start();
mainRouter(the_app, the_app.HTTPServer.router);
// eslint-disable-next-line no-console
console.log("Population finished");
if (SEALIOUS_SANITY) {
console.error("Exiting with error code 0");
process.exit(0);
}
} catch (error) {
console.error(error);
if (SEALIOUS_SANITY) {
console.error("EXITING WITH STATUS 1");
process.exit(1);
}
}
})();

File Metadata

Mime Type
text/x-java
Expires
Thu, Jul 3, 03:02 (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
765815
Default Alt Text
index.ts (1 KB)

Event Timeline