Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/std/http/server.ts>serve

A modern runtime for JavaScript and TypeScript.
Go to Latest
function serve
import { serve } from "https://deno.land/x/deno@v0.28.0/std/http/server.ts";

Start a HTTP server

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

Parameters

addr: string | ServerConfig