import { serveListener } from "https://dotland.deno.dev/std@0.181.0/http/server.ts";
Constructs a server, accepts incoming connections on the given listener, and handles requests on these connections with the given handler.
import { serveListener } from "https://deno.land/std@0.181.0/http/server.ts";
const listener = Deno.listen({ port: 4505 });
console.log("server listening on http://localhost:4505");
await serveListener(listener, (request) => {
const body = `Your user-agent is:\n\n${request.headers.get(
"user-agent",
) ?? "Unknown"}`;
return new Response(body, { status: 200 });
});