
Deno unveils faster, simpler web server API

Deno 1.35, the latest version of the JavaScript/TypeScript/WebAssembly runtime positioned as an alternative to Node.js, stabilizes 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()andReadableStream.from()APIs, whileURLSearchParams.delete()andURLSearchParams()now support thevalueparameter. - The
semvermodule of the standard library has been rewritten to reduce internal complexity and clean up public interfaces. Also, eachsemverinstance becomes an immutable plain JavaScript object. - A new standard module,
html, has been added. The module hasescapeandunescapeAPIs, which escape and unescape the special HTML characters in the given strings. Additionally, anhttp/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
Deno.atomicOperationandDeno.errors.Filesytemloop. - Deno 1.35 ships with the Google V8 6 JavaScript/WebAssembly engine and TypeScript 5.1.6.
Copyright © 2023 IDG Communications, Inc.
<!-- var slotName = 'bottomleaderboard'; var slotSize = []; if ($thm.deviceClass == 'mobile') { slotSize = [[300,50],[320,50],[300,250]]; } else if ($thm.deviceClass == 'tablet') { slotSize = [[728,90],[468,60]]; } else { slotSize = [[728,90],[970,90],[970,250]]; } IDG.GPT.addDisplayedAd(slotName, "true"); document.write('
'); IDG.GPT.defineGoogleTagSlot(slotName, slotSize, false, true); document.write('
'); $('#' + slotName).responsiveAd({screenSize:'971 1115', scriptTags: []}, true); //-->
