INNER CODE UNIT · JavaScript
resolvePort
iamlukethedev/Hermes3D · server/index.js:10
const resolvePort = () => {
const raw = process.env.PORT?.trim() || "3000";
const port = Number(raw);
if (!Number.isFinite(port) || port <= 0) return 3000;
return port;
};
const resolvePathname = (url) => {
const raw = typeof url === "string" ? url : "";
const idx = raw.indexOf("?");
return (idx === -1 ? raw : raw.slice(0, idx)) || "/";
};
const CERT_DIR = require("node:path").join(__dirname, "..", ".certs");
const CERT_PATH = require("node:path").join(CERT_DIR, "localhost.crt");
const KEY_PATH = require("node:path").join(CERT_DIR, "localhost.key");
const generateHttpsCert = async () => {