-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathoptions.js
More file actions
94 lines (90 loc) · 2.38 KB
/
Copy pathoptions.js
File metadata and controls
94 lines (90 loc) · 2.38 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
const commander = require('commander')
const opts = commander
.version(require('./package.json').version)
.usage('[path] [options]')
.option(
'-a, --address [0.0.0.0]',
'address to use',
'0.0.0.0'
).option(
'-p, --ssl-port [4443]',
'ssl port to use',
4443
).option(
'--http-port [8080]',
'http port which redirects to ssl port',
8080
).option(
'-c, --cache',
'enable cache'
).option(
'-m, --maxAge [0]',
`cache maxAge in ms acceptable string
https://github.com/zeit/ms
`
).option(
'-P, --no-push',
'disable naive PUSH_PROMISE'
).option(
'-o, --open [xdg-open]',
`open default app after starting the server
-o firefox
-o "google-chrome --incognito"
-o "curl --insecure"
`
).option(
'-l, --log [dev]',
`log format (dev|combined|common|short|tiny)
https://github.com/expressjs/morgan#predefined-formats
`,
'dev'
).option(
'-s, --silent',
'suppress log messages from output'
).option(
'--cors',
'enable CORS'
).option(
'-S, --no-ssl',
`disable https
Works as plain http server without http2, spdy, push_promise
`
).option(
'-e, --cert [certs/cert.pem]',
'path to ssl cert file',
'certs/cert.pem'
).option(
'-k, --key [certs/key.pem]',
'path to ssl key file',
'certs/key.pem'
).option(
'--generate-cert',
'save autogenerated certificates and exit'
).option(
'--trust-cert',
'add certificate to trusted (currently linux only)'
).option(
'-g, --compression',
'enable deflate/gzip/brotli/zopfli'
).option(
'-i, --index [index.html]',
'Specify index file name',
'index.html'
).option(
'--proxy [https://127.0.0.1:4443]',
`Proxies all requests which can't be resolved locally to the given url.
e.g.: -P http://someurl.com`
).option(
'-I, --no-autoindex',
'Disable auto index'
).option(
'--404 []',
'404 error page [blocks proxying]'
)
.parse(process.argv)
opts.protocol = opts.ssl ? 'https' : 'http'
opts.serverType = opts.ssl ? 'Http2/Https' : 'Http'
opts.URL = `${opts.protocol}://${opts.address}:${opts.ssl ? opts.sslPort : opts.httpPort}`
module.exports = opts
// http://stackoverflow.com/questions/31100474/accessing-non-ssl-socket-io-nodejs-server-from-ssl-apache-request-same-host
// -r or --robots Provide a /robots.txt (whose content defaults to 'User-agent: *\nDisallow: /')