Implement a minimal local HTTP server
RipplingSoftware Engineer · OnsiteLast updated
This question evaluates proficiency in network programming, HTTP/1.1 protocol parsing, concurrent server design, request routing and security (including path traversal protection), observability, testing, and graceful shutdown using only the language standard library.
Implement a minimal local HTTP server from scratch (no frameworks). Requirements: listen on a configurable port, parse HTTP/1.1 requests, support GET and POST, route two endpoints (/health returning 200 OK; /echo returning the request body), serve static files from a directory with correct Content-Type, handle concurrent connections, request timeouts, graceful shutdown, and structured request logging. Return appropriate errors (400/404/ 405). Include unit tests and clear run instructions for local development.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.