Skip to content
skillbld
Node.js · 14-day planAll days
Day 9 of 14 30 min

Build a web server with nothing but Node's http module. Understand requests and responses, read the method, URL, query string and headers, send HTML and JSON with the right status codes, route requests to handlers, and serve files.

By the end of today you can

  • Start an HTTP server and send a response
  • Read the method, path, query string and headers of a request
  • Send JSON and HTML with correct status codes and Content-Type headers
  • Route requests to handlers and return 404 for unknown paths
  • Call your server with fetch to test it

What's inside

  • 6 sections
  • 2 diagrams and mind maps
  • 4 code examples you can run
  • 5-question quiz
  1. 1Hello, server
  2. 2Requests and responses
  3. 3Reading the URL and headers
  4. 4Status codes
  5. 5Routing
  6. 6Serving files

Sign in free to read this lesson

Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.

Sign in free

Keep going

Day 9: An HTTP Server · Node.js · SkillBld