2019-02-07 11:45:47 -05:00
|
|
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2019-02-24 16:53:13 -05:00
|
|
|
import { serve } from "./server.ts";
|
2018-12-06 17:19:12 -05:00
|
|
|
|
2019-03-07 19:25:16 -05:00
|
|
|
const addr = Deno.args[1] || "127.0.0.1:4500";
|
2018-12-06 17:19:12 -05:00
|
|
|
const server = serve(addr);
|
|
|
|
|
|
|
|
const body = new TextEncoder().encode("Hello World");
|
|
|
|
|
|
|
|
async function main(): Promise<void> {
|
2019-05-14 17:49:53 -04:00
|
|
|
console.log(`http://${addr}/`);
|
2019-02-19 12:38:19 -05:00
|
|
|
for await (const request of server) {
|
2019-04-06 20:58:01 -04:00
|
|
|
request.respond({ status: 200, body });
|
2018-12-06 17:19:12 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
main();
|