std/http/mod.ts

Deno standard library
Go to Latest
function serve
import { serve } from "https://deno.land/std@0.81.0/http/mod.ts?s=serve";

Create a HTTP server

import { serve } from "https://deno.land/std/http/server.ts";
const body = "Hello World\n";
const server = serve({ port: 8000 });
for await (const req of server) {
  req.respond({ body });
}