Skip to main content
PProfileMatch
← Path

Node.js · Build a Node.js HTTP Server with the Built-in http Module

0 XP
  1. 1 current stop: learning
  2. 2 upcoming
  3. 3 upcoming
  4. 4 upcoming
  5. 5 upcoming

Finish after stop 5

Stop 1 of 5 · Lobby with a row of lockers

Trick to keep in mind+3 XP

Every path through a handler must end in res.end(), or that client waits forever.

The response is only finished once res.end() runs, and Node will not do it for you. If one branch returns without sending anything, only requests that reach that branch sit open until the client times out; other routes keep answering. A forgotten content-type header or an async handler does not cause a hang on its own.

Read it once, then a question tests whether the trick stuck.