Hung127/simple-http-server ? reverse-engineered prompt

Reverse engineered prompt

Build me a simple HTTP server in Java from scratch, without Maven, Gradle, Spring, or the built in Java HTTP server.

I want it to run from plain javac, use a raw ServerSocket, and handle requests with a small custom thread pool so it can accept multiple connections without starting a new thread for every request. It should serve a few static pages and assets from a local web folder, return the right content type for HTML, CSS, and SVG, and protect against path traversal.

Also add a small JSON todo API under /api that can create, read, update, and delete todos in memory, with routes that support path variables like an id. Parse request headers and bodies, respect Content Length, and return proper HTTP status codes and simple error pages when something goes wrong.

If you need to, look up current docs online for anything unclear, but keep the code straightforward and easy to learn from.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab