2020-01-02 15:13:47 -05:00
|
|
|
// Copyright 2018-2020 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
|
|
|
|
2020-01-09 13:37:01 -05:00
|
|
|
const addr = Deno.args[0] || "127.0.0.1:4500";
|
2018-12-06 17:19:12 -05:00
|
|
|
const server = serve(addr);
|
|
|
|
const body = new TextEncoder().encode("Hello World");
|
|
|
|
|
2019-10-28 15:58:35 -04:00
|
|
|
console.log(`http://${addr}/`);
|
|
|
|
for await (const req of server) {
|
2019-12-12 00:02:23 -05:00
|
|
|
const res = {
|
|
|
|
body,
|
|
|
|
headers: new Headers()
|
|
|
|
};
|
|
|
|
res.headers.set("Date", new Date().toUTCString());
|
|
|
|
res.headers.set("Connection", "keep-alive");
|
|
|
|
req.respond(res).catch(() => {});
|
2018-12-06 17:19:12 -05:00
|
|
|
}
|