Computer scienceBackendNode.jsCore ConceptsInternal modulesHTTP serverhttp module

Introduction to the HTTP module

Broken code

Report a typo

Here is a code snippet that creates a new server that gives an empty response. But it's not working.

const http = require('node:http');

const server = http.createServer((request, response) => {
  response.end();
});

Type an additional line of code to make this code snippet work. The server should be on port 80.

Enter a short text

Create a free account to access the full topic