summaryrefslogtreecommitdiff
path: root/std/examples/chat/server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/examples/chat/server.ts')
-rw-r--r--std/examples/chat/server.ts6
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}....`);