We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 70917bf commit 517491bCopy full SHA for 517491b
src/_utils.ts
@@ -8,6 +8,10 @@ export function resolvePortAndHost(opts: ServerOptions): {
8
} {
9
const _port = opts.port ?? globalThis.process?.env.PORT ?? 3000;
10
const port = typeof _port === "number" ? _port : Number.parseInt(_port, 10);
11
+ if (port < 0 || port > 65_535) {
12
+ throw new RangeError(`Port must be between 0 and 65535 (got "${port}").`);
13
+ }
14
+
15
const hostname = opts.hostname ?? globalThis.process?.env.HOST;
16
return { port, hostname };
17
}
0 commit comments