Created
November 26, 2020 19:48
-
-
Save ianaya89/d6e3c532066efc4ce50251d9f48c4722 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.79.0/http/server.ts"; | |
const server = serve({ hostname: "0.0.0.0", port: 8080 }); | |
console.log(`HTTP webserver running. Access it at: http://localhost:8080/`); | |
for await (const request of server) { | |
let bodyContent = "Your user-agent is:\n\n"; | |
bodyContent += request.headers.get("user-agent") || "Unknown"; | |
request.respond({ status: 200, body: bodyContent }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment