INNER CODE UNIT · TypeScript
isEntrypoint
runvendo/vendo · corpus/hosts/express-host/src/server/index.ts:115
function isEntrypoint(): boolean {
return process.argv[1] !== undefined && fileURLToPath(import.meta.url) === resolve(process.argv[1]);
}
if (isEntrypoint()) {
const port = Number(process.env.PORT ?? 3210);
if (!Number.isInteger(port) || port < 1 || port > 65_535) throw new Error(`Invalid PORT: ${process.env.PORT}`);
process.env.VENDO_BASE_URL ??= `http://127.0.0.1:${port}`;
// Loopback only: the principal resolver hands every request the demo
// principal, so the fixture must never be reachable from the LAN.
createRelayServer().app.listen(port, "127.0.0.1", () => {
console.log(`Relay listening at http://localhost:${port}`);
});
}