diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-03-29 04:03:49 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-28 13:03:49 -0400 |
commit | bced52505f32d6cca4f944bb610a8a26767908a8 (patch) | |
tree | da49a5df4b7bd6f8306248069228cd6bd0db1303 /std/examples/chat | |
parent | 1397b8e0e7c85762e19d88fde103342bfa563360 (diff) |
Update to Prettier 2 and use ES Private Fields (#4498)
Diffstat (limited to 'std/examples/chat')
-rw-r--r-- | std/examples/chat/server.ts | 20 | ||||
-rw-r--r-- | std/examples/chat/server_test.ts | 6 |
2 files changed, 13 insertions, 13 deletions
diff --git a/std/examples/chat/server.ts b/std/examples/chat/server.ts index 08aede05b..eb5b2f7d4 100644 --- a/std/examples/chat/server.ts +++ b/std/examples/chat/server.ts @@ -3,7 +3,7 @@ import { acceptWebSocket, acceptable, WebSocket, - isWebSocketCloseEvent + isWebSocketCloseEvent, } from "../../ws/mod.ts"; const clients = new Map<number, WebSocket>(); @@ -29,19 +29,19 @@ async function wsHandler(ws: WebSocket): Promise<void> { } } -listenAndServe({ port: 8080 }, async req => { +listenAndServe({ port: 8080 }, async (req) => { if (req.method === "GET" && req.url === "/") { //Serve with hack const u = new URL("./index.html", import.meta.url); if (u.protocol.startsWith("http")) { // server launched by deno run http(s)://.../server.ts, - fetch(u.href).then(resp => { + fetch(u.href).then((resp) => { return req.respond({ status: resp.status, headers: new Headers({ - "content-type": "text/html" + "content-type": "text/html", }), - body: resp.body + body: resp.body, }); }); } else { @@ -50,9 +50,9 @@ listenAndServe({ port: 8080 }, async req => { req.respond({ status: 200, headers: new Headers({ - "content-type": "text/html" + "content-type": "text/html", }), - body: file + body: file, }); } } @@ -60,8 +60,8 @@ listenAndServe({ port: 8080 }, async req => { req.respond({ status: 302, headers: new Headers({ - location: "https://deno.land/favicon.ico" - }) + location: "https://deno.land/favicon.ico", + }), }); } if (req.method === "GET" && req.url === "/ws") { @@ -70,7 +70,7 @@ listenAndServe({ port: 8080 }, async req => { conn: req.conn, bufReader: req.r, bufWriter: req.w, - headers: req.headers + headers: req.headers, }).then(wsHandler); } } diff --git a/std/examples/chat/server_test.ts b/std/examples/chat/server_test.ts index 13a5c337c..673b61174 100644 --- a/std/examples/chat/server_test.ts +++ b/std/examples/chat/server_test.ts @@ -11,7 +11,7 @@ async function startServer(): Promise<Deno.Process> { const server = Deno.run({ cmd: [Deno.execPath(), "--allow-net", "--allow-read", "server.ts"], cwd: "examples/chat", - stdout: "piped" + stdout: "piped", }); try { assert(server.stdout != null); @@ -45,7 +45,7 @@ test({ server.stdout!.close(); } await delay(10); - } + }, }); test({ @@ -65,5 +65,5 @@ test({ server.stdout!.close(); ws!.conn.close(); } - } + }, }); |