Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 6c15d87

Browse files
Add the --host flag to allow having a custom hostname in production mode.
1 parent 28b8654 commit 6c15d87

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import { injectHmr, Project } from './project.ts'
77
import { path, serve, ws } from './std.ts'
88
import util, { hashShort } from './util.ts'
99

10-
export async function start(appDir: string, port: number, isDev = false, reload = false) {
10+
export async function start(appDir: string, hostname: string, port: number, isDev = false, reload = false) {
1111
const project = new Project(appDir, isDev ? 'development' : 'production', reload)
1212
await project.ready
1313

1414
while (true) {
1515
try {
16-
const s = serve({ port })
17-
log.info(`Server ready on http://localhost:${port}`)
16+
const s = serve({ hostname, port })
17+
log.info(`Server ready on http://${hostname}:${port}`)
1818
for await (const req of s) {
1919
const url = new URL('http://localhost/' + req.url)
2020
const pathname = util.cleanPath(url.pathname)

0 commit comments

Comments
 (0)