Last active
March 8, 2021 18:17
-
-
Save grant/ff863b49b3eca3522b7f2a2d6af3584d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { serve } from "https://deno.land/std@0.89.0/http/server.ts"; | |
import "https://deno.land/x/dotenv/mod.ts"; | |
const PORT = Deno.env.get('PORT') || 8080; | |
const s = serve(`0.0.0.0:${PORT}`); | |
const body = new TextEncoder().encode("Hello, Deno\n"); | |
console.log(`Server started on port ${PORT}`); | |
for await (const req of s) { | |
req.respond({ body }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment