App is the main entry point for your web server. It wraps an HTTP server, manages its lifecycle, and handles graceful shutdown when the process receives a stop signal.
What an App does
When you create an app withmizu.New(), you get:
Create an app
Every Mizu project starts by creating anApp:
mizu.New()creates an app with a router and default loggerapp.Get("/", ...)registers a handler for GET requests to ”/”app.Listen(":3000")starts the HTTP server
Starting the server
Mizu provides three ways to start your server:Configuration
Configure the app by setting fields after creation:Graceful shutdown
When your app receives a stop signal (SIGINT or SIGTERM):- New connections refused - The server stops accepting new connections
- Active requests complete - Running requests continue until finished (up to
ShutdownTimeout) - Clean exit - Server exits with success status
ShutdownTimeout, they’re terminated.
Health check endpoints
Mizu provides two health check handlers for load balancers and orchestrators like Kubernetes:
How they differ:
- Liveness (
/livez): “Is the process running?” Used by Kubernetes to decide if the pod should be restarted - Readiness (
/readyz): “Can it handle traffic?” Used by load balancers to route traffic
/readyz returns 503 so load balancers stop sending new traffic, while /livez continues returning 200 so the pod isn’t killed prematurely.
Access the underlying server
For advanced configuration, access thehttp.Server instance:
Complete example
Next steps
Routing
Define URLs and HTTP methods.
Handler
Write request handling logic.