Skip to content

Commit ee46263

Browse files
authored
feat: Add localhost help text to server address output (#3077)
When binding to `0.0.0.0` or `::`, show localhost equivalent URL for convenience Closes #3076 output from fresh www ``` deno task start Task start deno run -A --watch=static/,routes/,../src,../docs dev.ts Watcher Process started. 🍋 Fresh ready Local: http://0.0.0.0:8000/ (http://localhost:8000/) GA4_MEASUREMENT_ID environment variable not set. Google Analytics reporting disabled. ```
1 parent 0b3546f commit ee46263

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/app.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ function createOnListen(
7676
const address = colors.cyan(
7777
`${protocol}//${hostname}:${params.port}${pathname}`,
7878
);
79+
const helper = hostname === "0.0.0.0" || hostname === "::"
80+
? colors.cyan(` (${protocol}//localhost:${params.port}${pathname})`)
81+
: "";
7982
// deno-lint-ignore no-console
80-
console.log(` ${localLabel} ${space}${address}${sep}`);
83+
console.log(` ${localLabel} ${space}${address}${helper}${sep}`);
8184
if (options.remoteAddress) {
8285
const remoteLabel = colors.bold("Remote:");
8386
const remoteAddress = colors.cyan(options.remoteAddress);

0 commit comments

Comments
 (0)