Spaces:
Runtime error
Runtime error
Download artifacts/api-server/src/index.ts from o134/Desinger-System: direct link, hf CLI and curl.
- Browser
- Download file 545 Bytes
-
https://huggingface.co/spaces/o134/Desinger-System/resolve/main/artifacts/api-server/src/index.ts
- Command line
-
hf download hf://spaces/o134/Desinger-System/artifacts/api-server/src/index.ts
-
curl -L -o index.ts https://huggingface.co/spaces/o134/Desinger-System/resolve/main/artifacts/api-server/src/index.ts
545 Bytes
| import "dotenv/config"; | |
| import app from "./app"; | |
| import { logger } from "./lib/logger"; | |
| const rawPort = process.env["PORT"] || "5001"; | |
| 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, (err) => { | |
| if (err) { | |
| logger.error({ err }, "Error listening on port"); | |
| process.exit(1); | |
| } | |
| logger.info({ port }, "Server listening"); | |
| }); | |