1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-04 17:18:23 -05:00
denoland-deno/http_test.ts

23 lines
430 B
TypeScript
Raw Normal View History

2018-11-08 15:03:45 -05:00
import { serve } from "./http.ts";
//import { test } from "https://deno.land/x/testing/testing.ts";
2018-11-07 01:08:51 -05:00
2018-11-08 15:03:45 -05:00
const addr = "0.0.0.0:8000";
const s = serve(addr);
console.log(`listening on http://${addr}/`);
const body = new TextEncoder().encode("Hello World\n");
2018-11-09 17:23:01 -05:00
2018-11-08 15:03:45 -05:00
async function main() {
for await (const req of s) {
2018-11-09 17:23:01 -05:00
await req.respond({ status: 200, body });
2018-11-08 15:03:45 -05:00
}
}
main();
/*
2018-11-07 10:18:48 -05:00
test(function basic() {
console.log("ok");
});
2018-11-08 15:03:45 -05:00
*/