Skip to content

Commit bf3d2fb

Browse files
committed
refactor: construct click friendly URL in welcome message
1 parent f16a1d6 commit bf3d2fb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/dev_server.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
import picomatch from 'picomatch'
1111
import type tsStatic from 'typescript'
12+
import prettyHrtime from 'pretty-hrtime'
1213
import { type ExecaChildProcess } from 'execa'
1314
import { cliui, type Logger } from '@poppinss/cliui'
1415
import type { Watcher } from '@poppinss/chokidar-ts'
1516

1617
import type { DevServerOptions } from './types.js'
1718
import { AssetsDevServer } from './assets_dev_server.js'
1819
import { getPort, isDotEnvFile, isRcFile, runNode, watch } from './helpers.js'
19-
import prettyHrtime from 'pretty-hrtime'
2020

2121
/**
2222
* Instance of CLIUI
@@ -113,11 +113,12 @@ export class DevServer {
113113
this.#httpServer.on('message', (message) => {
114114
if (this.#isAdonisJSReadyMessage(message)) {
115115
const readyAt = process.hrtime(initialTime)
116+
const host = message.host === '0.0.0.0' ? '127.0.0.1' : message.host
116117

117118
ui.sticker()
118119
.useColors(this.#colors)
119120
.useRenderer(this.#logger.getRenderer())
120-
.add(`Server address: ${this.#colors.cyan(`http://${message.host}:${message.port}`)}`)
121+
.add(`Server address: ${this.#colors.cyan(`http://${host}:${message.port}`)}`)
121122
.add(
122123
`File system watcher: ${this.#colors.cyan(
123124
`${this.#isWatching ? 'enabled' : 'disabled'}`

0 commit comments

Comments
 (0)