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}/`);
|
|
|
|
|
2018-12-06 16:08:21 -05:00
|
|
|
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
|
|
|
*/
|