How harshit3011/custom-http-server-go works
This repository is a small custom HTTP/1.1 server. A client connection is accepted by the server entry point, parsed into a request, dispatched through registered routes and middleware, and written back as an HTTP response; parse failures are converted to error responses at the entry point. The README also documents logging, request IDs, metrics, panic recovery, and graceful shutdown, which are implemented or configured in the sampled entry point and middleware. The server package is an empty placeholder. The graph reflects sampled source and README claims; no separate server-package behavior is shown.
Main entry points: main.go Server Entry · router.go Router · response.go Response Writer · middleware.go Middleware Stack
Components 8
Connection Runtime
- Server Entry
cmd/server/main.go - HTTP Response Output
cmd/server/main.go
HTTP Parsing
- Request Parser
parser/request.go
Route Dispatch
- Router
router/router.go
Response Handling
- Response Writer
response/response.go
Middleware
- Middleware Stack
middleware/middleware.go - Request Metrics
middleware/middleware.go
Other components
- HTTP Client
Connections 12
- HTTP Client → Server Entry: opens TCP connection
cmd/server/main.go - Server Entry → Router: registers routes
cmd/server/main.go - Server Entry → Router: configures middleware
cmd/server/main.go - Server Entry → Request Parser: parses request
cmd/server/main.go - Server Entry → Router: dispatches request
cmd/server/main.go - Router → Middleware Stack: wraps handler
router/router.go - Router → Response Writer: creates response
router/router.go - Middleware Stack → Response Writer: updates response
middleware/middleware.go - Server Entry → Response Writer: formats parse errors
cmd/server/main.go - Server Entry → HTTP Response Output: serializes response
cmd/server/main.go - HTTP Response Output → HTTP Client: writes HTTP response
cmd/server/main.go - Server Entry → Request Metrics: snapshots metrics
cmd/server/main.go