HTTP Haven is a hands-on Go project designed to help you learn and practice building HTTP servers, routing, handlers, and REST-style endpoints using Go’s standard net/http library.
The project is structured as a series of progressively challenging exercises, each implemented in its own Go file.
http-haven/
├── cheatsheet.md # Quick reference for HTTP concepts & Go net/http
├── exercise.md # Instructions and goals for exercises
├── exercise1.go # Basic HTTP server
├── exercise2.go # Routing basics
├── exercise3.go # Query parameters
├── exercise4.go # JSON responses
├── exercise5.go # Request parsing
├── exercise6.go # Middleware concepts
├── exercise7.go # Advanced endpoint handling
├── main.go # Entry point / runner (if applicable)
├── go.mod # Go module definition
└── test_endpoints.sh # Script to test endpoints
🧩 Exercises Overview
Create a simple HTTP server that responds to /.
Add multiple routes with different handlers.
Parse URL query parameters and respond dynamically.
Return structured JSON from endpoints.
Handle POST requests and decode JSON bodies.
Implement logging or request timing wrappers.
Combine everything into a more realistic API design.
Build a simple server that responds to / with a message like "Hello, HTTP Haven!".
Create multiple endpoints such as:
/ /hello /status
Each should return a different response.
Handle URLs like:
/greet?name=John
Return a personalized response using the query parameter.
Return structured JSON:
{
"message": "Hello",
"status": "success"
}Handle POST requests with JSON input like:
{
"name": "John",
"age": 25
}Parse and respond with processed data.
Implement middleware patterns such as:
Logging requests Measuring response time Basic request validation
Combine everything into a mini API with:
Multiple endpoints JSON input/output Middleware wrapping Clean handler structure