Select the directory option from the above "Directory" header!

Menu
Deno unveils faster, simpler web server API

Deno unveils faster, simpler web server API

The Deno.serve() API promises significant performance benefits and allows developers to create a web server with a single line of code.

Comments
Credit: Dreamstime

Deno 1.35, the latest version of the JavaScript/TypeScript/WebAssembly runtime positioned as an alternative to Node.js, stabilises Deno.serve(), a new API that makes it easier to build web servers.

The 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 Headers.getSetCookie() and ReadableStream.from() APIs, while URLSearchParams.delete() and URLSearchParams() now support the value parameter.
  • The semver module of the standard library has been rewritten to reduce internal complexity and clean up public interfaces. Also, each semver instance becomes an immutable plain JavaScript object. 
  • A new standard module, html, has been added. The module has escape and unescape APIs, which escape and unescape the special HTML characters in the given strings. Additionally, an http/user_agent has 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 Deno.atomicOperation and Deno.errors.Filesytemloop.
  • Deno 1.35 ships with the Google V8 6 JavaScript/WebAssembly engine and TypeScript 5.1.6.

Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags API

Show Comments