Q27: How do you create a basic HTTP server using core Node.js modules?
Use http.createServer((req, res) => {}) to handle incoming HTTP connections, set response headers with res.setHeader(), and end the response using res.end().
Key Takeaways
- Core
httpmodule creates web servers without external frameworks. - Request handlers accept
IncomingMessage(req) andServerResponse(res).
Knowledge Check
Which method sends the final response body and signals request completion?