diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-09-20 18:32:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-20 18:32:18 -0400 |
commit | 97bb2bdb79cbd0a400c643e7be0029440cb15633 (patch) | |
tree | 92c883d38b7af413fcbfbac82f17775a7064dfec /tools/deno_tcp.ts | |
parent | 93b7acf99d6456e6e194c03f024b788ce5adf20e (diff) |
dial/listen API change (#3000)
Previously: dial("tcp", "deno.land:80")
Now: dial({ hostname: "deno.land", port: 80, transport: "tcp" })
Similarly with listen().
Diffstat (limited to 'tools/deno_tcp.ts')
-rw-r--r-- | tools/deno_tcp.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/deno_tcp.ts b/tools/deno_tcp.ts index d744a09c1..2b259cd38 100644 --- a/tools/deno_tcp.ts +++ b/tools/deno_tcp.ts @@ -3,7 +3,8 @@ // https://github.com/denoland/deno/issues/726 is completed. // Note: this is a keep-alive server. const addr = Deno.args[1] || "127.0.0.1:4500"; -const listener = Deno.listen("tcp", addr); +const [hostname, port] = addr.split(":"); +const listener = Deno.listen({ hostname, port: Number(port) }); const response = new TextEncoder().encode( "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n" ); |