Create main.ts
Browse files
main.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { serve } from "https://deno.land/std@0.77.0/http/server.ts";
|
| 2 |
+
|
| 3 |
+
const PORT = 8000;
|
| 4 |
+
const s = serve(`0.0.0.0:${PORT}`);
|
| 5 |
+
const body = new TextEncoder().encode("Hello World\n");
|
| 6 |
+
|
| 7 |
+
console.log(`Server started on port ${PORT}`);
|
| 8 |
+
for await (const req of s) {
|
| 9 |
+
req.respond({ body });
|
| 10 |
+
}
|