startServer onListen logs https when key & cert specified (#2321)
Some team members of mine were confused by the default output ``` 🍋 Fresh ready Local: http://localhost:8000/ ``` when the server is actually running HTTPS. This should now print ``` 🍋 Fresh ready Local: https://localhost:8000/ ``` when a key and cert are specified.
This commit is contained in:
+3
-1
@@ -9,8 +9,10 @@ export async function startServer(
|
|||||||
if (!opts.onListen) {
|
if (!opts.onListen) {
|
||||||
opts.onListen = (params) => {
|
opts.onListen = (params) => {
|
||||||
const pathname = opts.basePath + "/";
|
const pathname = opts.basePath + "/";
|
||||||
|
const https = !!(opts.key && opts.cert);
|
||||||
|
const protocol = https ? "https:" : "http:";
|
||||||
const address = colors.cyan(
|
const address = colors.cyan(
|
||||||
`http://localhost:${params.port}${pathname}`,
|
`${protocol}//localhost:${params.port}${pathname}`,
|
||||||
);
|
);
|
||||||
const localLabel = colors.bold("Local:");
|
const localLabel = colors.bold("Local:");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user