From ee4626305370cf395aaaf935d26a605c6d00f941 Mon Sep 17 00:00:00 2001 From: Coty <13724650+cotyhamilton@users.noreply.github.com> Date: Tue, 8 Jul 2025 18:58:04 -0400 Subject: [PATCH] feat: Add localhost help text to server address output (#3077) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. ``` --- src/app.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index eb143d28..72543b1a 100644 --- a/src/app.ts +++ b/src/app.ts @@ -76,8 +76,11 @@ function createOnListen( const address = colors.cyan( `${protocol}//${hostname}:${params.port}${pathname}`, ); + const helper = hostname === "0.0.0.0" || hostname === "::" + ? colors.cyan(` (${protocol}//localhost:${params.port}${pathname})`) + : ""; // deno-lint-ignore no-console - console.log(` ${localLabel} ${space}${address}${sep}`); + console.log(` ${localLabel} ${space}${address}${helper}${sep}`); if (options.remoteAddress) { const remoteLabel = colors.bold("Remote:"); const remoteAddress = colors.cyan(options.remoteAddress);