Deno.serve(), a new API that makes it easier to build web servers.
Deno.serve() API provides a “fast and convenient” way to create web servers, according to Deno project developers, who announced Deno 1.35 on July 5, calling it a minor release.
Deno.serve() is described as a long-awaited new web server API offering ease of use while significantly enhancing performance. Developers can use the API to set up a web server via a single line of code:
Deno.serve((req) => new Response("hello world"));
A previous API,
Deno.serveHTTP(), required the setup of an async iterator over connections and subsequent handling of HTTP events.
Deno.serve() uses web standard Request and Response objects for seamless interaction with
fetch(), web streams, and other standard APIs.
Deno’s developers said that, in internal benchmarks,
Deno.serve() delivered twice the throughput of a similar Node.js server, with better tail latency and more efficient memory use.
Deno runs on Linux, Windows, and macOS as a single binary executable. Installation instructions can be found at the Deno website. Deno 1.35 follows the late-May release of Deno 1.34, which boosted compatibility with NPM and Node.js.
Other new and improved features in Deno 1.35:
- Web API changes include support for
URLSearchParams()now support the
semvermodule of the standard library has been rewritten to reduce internal complexity and clean up public interfaces. Also, each
- A new standard module,
html, has been added. The module has
unescapeAPIs, which escape and unescape the special HTML characters in the given strings. Additionally, an
http/user_agenthas been added that detects OS, CPU, device, and browser types from the given user agent.
- Quality-of-life improvements have been made to the language server. These include fixing a longstanding problem with auto-imports for NPM packages and import maps.
- NPM and Node.js compatibility were further improved, with Node.js module changes made.
- APIs were added to the Denocode namespace such as