A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.deno.com/examples/http_server/ below:

Website Navigation


HTTP Server: Hello world

Edit on Github

An example of a HTTP server that serves a "Hello World" message.

HTTP servers need a handler function. This function is called for every request that comes in. It must return a `Response`. The handler function can be asynchronous (it may return a `Promise`).

function handler(_req: Request): Response {
  return new Response("Hello, World!");
}

To start the server on the default port, call `Deno.serve` with the handler.

Deno.serve(handler);

Run this example locally using the Deno CLI:

deno run -N https://docs.deno.com/examples/scripts/http_server.ts

Try this example in a Deno Deploy playground

Additional resources

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4