Skip to content

Instantly share code, notes, and snippets.

@hmaurer
Last active August 9, 2020 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hmaurer/5537981c72ba85aac1c21a2b55e8085c to your computer and use it in GitHub Desktop.
Save hmaurer/5537981c72ba85aac1c21a2b55e8085c to your computer and use it in GitHub Desktop.
Simple Deno HTTP server for Nix
import { serve } from "https://deno.land/std@v0.63.0/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