Verified Commit 77ba8472 authored by Aral Balkan's avatar Aral Balkan
Browse files

Add --http2 flag to the command-line interface

parent bb140c3e
......@@ -43,8 +43,10 @@ if (!fs.existsSync(pathToServe)) {
process.exit(1)
}
const http2 = (arguments.http2 === true)
// Start the server.
httpsServer.serve(pathToServe, {port})
httpsServer.serve(pathToServe, {port, http2})
// Helpers.
......
......@@ -62,7 +62,7 @@ class HttpsServer {
}
const port = options.port || 443
const isHTTP2 = options.isHTTP2 || false
const isHTTP2 = options.http2 || false
const serverCreationMethod = isHTTP2 ? this.createSecureServer : this.createServer
this.ensureWeCanBindToPort(port, pathToServe)
......@@ -75,7 +75,11 @@ class HttpsServer {
if (serverPort !== 443) {
portSuffix = `:${serverPort}`
}
console.log(` 🎉 Serving ${pathToServe} on https://localhost${portSuffix}\n`)
let isHTTP2Note = ''
if (isHTTP2) {
isHTTP2Note = ' (HTTP2)'
}
console.log(` 🎉 Serving ${pathToServe} on https://localhost${portSuffix}${isHTTP2Note}\n`)
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment