Home/Tutorials/Node.js/HTTP Module Basics

0 of 3 saved

Node.js5 min read

HTTP Module Basics

Read this chapter, write the program on this page, then pass a short check to open the next one.

Tiny servers without Express.

HTTP Module Basics

node:http can create a server. Express wraps this with routing and middleware โ€” learn the idea here, then move to Express.

  • createServer((req, res) => { ... })
  • Set statusCode and headers before writing the body.
  • listen(port) starts accepting connections.
console.log("http-basics");

After you read this chapter, use Write (when available) and Quiz on this page to lock it in.