|
@@ -1,9 +1,8 @@
|
|
const HELLO_WORLD_STR = "Hello, World!";
|
|
const HELLO_WORLD_STR = "Hello, World!";
|
|
const options: ResponseInit = { headers: { "Server": "Deno" } };
|
|
const options: ResponseInit = { headers: { "Server": "Deno" } };
|
|
|
|
|
|
-Deno.serve({
|
|
|
|
- reusePort: true,
|
|
|
|
- handler: (req: Request) => {
|
|
|
|
|
|
+export default {
|
|
|
|
+ fetch: (req: Request) => {
|
|
const path = req.url.slice(req.url.indexOf("/", 8));
|
|
const path = req.url.slice(req.url.indexOf("/", 8));
|
|
if (path == "/plaintext") {
|
|
if (path == "/plaintext") {
|
|
return new Response(HELLO_WORLD_STR, options);
|
|
return new Response(HELLO_WORLD_STR, options);
|
|
@@ -13,10 +12,4 @@ Deno.serve({
|
|
return new Response("404 Not Found", { status: 404, ...options });
|
|
return new Response("404 Not Found", { status: 404, ...options });
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- onError(err) {
|
|
|
|
- console.error(err);
|
|
|
|
- Deno.exit(9);
|
|
|
|
- },
|
|
|
|
- port: 8080,
|
|
|
|
- hostname: "0.0.0.0",
|
|
|
|
-});
|
|
|
|
|
|
+};
|