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 resourcesRetroSearch 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