forked from daquinoaldo/https-localhost
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
28 lines (23 loc) · 760 Bytes
/
Copy pathcli.ts
File metadata and controls
28 lines (23 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import HttpsLocalhost from "./HttpsLocalhost"
// TODO: here or in index?
(process as NodeJS.EventEmitter).on("uncaughtException", err => {
switch (err.code) {
case "EACCES":
console.error(
"EACCES: run as administrator to use the default ports 443 and 80. " +
"You can also change port with: `PORT=4433 serve ~/myproj`.")
break
case "EADDRINUSE":
console.error("EADDRINUSE: another service on your machine is using " +
"the current port.\nStop it or change port with:" +
"`PORT=4433 serve ~/myproj`.")
break
default:
console.error("Unexpected error " + err.code + ":\n\n" + err)
break
}
process.exit(1)
})
if (require.main === module) {
new HttpsLocalhost().serve()
}