Skip to content

Instantly share code, notes, and snippets.

@sunfmin
Last active February 25, 2019 12:48
Show Gist options
  • Save sunfmin/3bf73c5e1672a7e8dd330cef12aa803d to your computer and use it in GitHub Desktop.
Save sunfmin/3bf73c5e1672a7e8dd330cef12aa803d to your computer and use it in GitHub Desktop.
import { test, assertEqual } from "https://deno.land/x/testing/mod.ts";
test(function t1() {
assertEqual("hello", "hello");
});
test(function t2() {
assertEqual("world", "world");
});
import { serve } from "https://deno.land/x/[email protected]/http/server.ts";
const s = serve("0.0.0.0:8000");
async function main() {
for await (const req of s) {
console.log("req = ", req)
req.respond({ body: new TextEncoder().encode("Hello World\n") });
}
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment