June 2025
Intermediate to advanced
837 pages
24h 50m
English
The basic concept of Node.js and Deno is the same. Both platforms make JavaScript available to you outside the browser. The primary use of Deno and Node.js is the implementation of dynamic web servers, so Deno also includes a number of structures that allow you to implement such a web server. Listing 28.16 shows the implementation of a simple web server. A detailed explanation follows right after.
const server = Deno.listen({ port: 8080 });console.log('Server is listening to http://localhost:8080'); for await (const connection of server) { handleConnection(connection);} async function handleConnection(connection) { const httpConnection = Deno.serveHttp(connection); for await (const request of httpConnection) {
Read now
Unlock full access