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/server.ts | |
parent | 1397b8e0e7c85762e19d88fde103342bfa563360 (diff) |
Update to Prettier 2 and use ES Private Fields (#4498)
Diffstat (limited to 'std/examples/chat/server.ts')
-rw-r--r-- | std/examples/chat/server.ts | 20 |
1 files changed, 10 insertions, 10 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); } } |