Log the full public UI URL using the REPLIT_DEV_DOMAIN environment variable. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 418bf6f8-212b-4bb0-a7a5-8231a061da4e Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: a00ebe7c-c8e0-4118-81aa-ae93770e942f Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/9f85e954-647c-46a5-90a7-396e495a805a/418bf6f8-212b-4bb0-a7a5-8231a061da4e/Q83Uqvu Replit-Helium-Checkpoint-Created: true
24 lines
509 B
TypeScript
24 lines
509 B
TypeScript
import app from "./app";
|
|
|
|
const rawPort = process.env["PORT"];
|
|
|
|
if (!rawPort) {
|
|
throw new Error(
|
|
"PORT environment variable is required but was not provided.",
|
|
);
|
|
}
|
|
|
|
const port = Number(rawPort);
|
|
|
|
if (Number.isNaN(port) || port <= 0) {
|
|
throw new Error(`Invalid PORT value: "${rawPort}"`);
|
|
}
|
|
|
|
app.listen(port, () => {
|
|
console.log(`Server listening on port ${port}`);
|
|
const domain = process.env["REPLIT_DEV_DOMAIN"];
|
|
if (domain) {
|
|
console.log(`Public UI: https://${domain}/api/ui`);
|
|
}
|
|
});
|