What is the Core Framework?
The Core framework (github.com/go-mizu/mizu) is a thin layer on top of Go’s net/http package that adds:
- App: Server lifecycle and configuration
- Router: URL pattern matching with Go 1.22+ patterns
- Handler: Request processing functions that return errors
- Context (Ctx): Request/response wrapper with helpers
- Middleware: Composable request processing pipeline
How Components Work Together
Key Concepts
App
The App is your server. It starts up, manages connections, and shuts down gracefully:- Graceful shutdown on SIGINT/SIGTERM
- Built-in health check endpoints (
/livez,/readyz) - Access to underlying
*http.Server
Learn More
Full App documentation with configuration options
Routing
Routes map URL patterns to handlers using Go 1.22+ patterns:Learn More
Full Routing documentation with advanced patterns
Handler
Handlers are functions that process requests and return errors:- Return
nilon success,erroron failure - Use Ctx helpers for reading/writing
- Let the error handler deal with errors
Learn More
Full Handler documentation with patterns
Context (Ctx)
Ctx wraps the request and response, providing convenient helpers:Learn More
Full Context documentation with all methods
Middleware
Middleware wraps handlers to add functionality:Learn More
Full Middleware documentation with patterns
Complete Example
Here’s a complete API using all Core concepts:Detailed Documentation
| Concept | Description | Link |
|---|---|---|
| App | Server lifecycle, shutdown, health checks | App → |
| Routing | URL patterns, groups, path parameters | Routing → |
| Handler | Request processing, return values | Handler → |
| Context | Request/response helpers | Context → |
| Request | Reading path, query, body, headers | Request → |
| Response | JSON, HTML, redirect, streaming | Response → |
| Static | Serving files and embedded assets | Static → |
| Logging | Structured logging with slog | Logging → |
| Error | Error handling and recovery | Error → |
| Middleware | Building request pipelines | Middleware → |