diff options
author | Yusuke Sakurai <kerokerokerop@gmail.com> | 2020-03-21 22:53:47 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-21 09:53:47 -0400 |
commit | 60cee4f045778777a16b6fffd6d5b9a1400d7246 (patch) | |
tree | a477bd147fbd548d478a289af5bd0681b1a34c4e /std/examples/chat/server.ts | |
parent | 0adc86f105204b2475126c36dfc10e678f67df56 (diff) |
avoid using same port number for test (#4147)
Diffstat (limited to 'std/examples/chat/server.ts')
-rw-r--r-- | std/examples/chat/server.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/std/examples/chat/server.ts b/std/examples/chat/server.ts index 08aede05b..d28f9f43f 100644 --- a/std/examples/chat/server.ts +++ b/std/examples/chat/server.ts @@ -29,7 +29,9 @@ async function wsHandler(ws: WebSocket): Promise<void> { } } -listenAndServe({ port: 8080 }, async req => { +const addr = Deno.args[0] ?? "127.0.0.1:8080"; + +listenAndServe(addr, async req => { if (req.method === "GET" && req.url === "/") { //Serve with hack const u = new URL("./index.html", import.meta.url); @@ -75,4 +77,4 @@ listenAndServe({ port: 8080 }, async req => { } } }); -console.log("chat server starting on :8080...."); +console.log(`chat server starting on ${addr}....`); |