Last active
August 9, 2020 21:15
-
-
Save hmaurer/5537981c72ba85aac1c21a2b55e8085c to your computer and use it in GitHub Desktop.
Simple Deno HTTP server for Nix
This file contains hidden or 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/[email protected]/http/server.ts"; | |
const s = serve({ port: 80 }); | |
for await (const req of s) { | |
if (req.url !== "/") { | |
req.respond({ status: 404 }); | |
} | |
const body = new TextEncoder().encode( | |
"Hello World from Deno on Nix (via Gist)" | |
); | |
req.respond({ body }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment