It creates the router, manages middleware, runs the HTTP server, and handles shutdown safely when the server stops.
Create an app
Every Mizu project begins by creating anApp instance.
mizu.New() creates a new app.app.Get() adds a route.app.Listen() starts the server on the given port.When you visit http://localhost:3000, the server responds with “Hello, Mizu!”.
How it works
TheApp type includes Mizu’s Router, so you can define routes and middleware on it directly.When
Listen is called, Mizu starts a standard Go net/http server.When the server receives a stop signal, Mizu performs a graceful shutdown and lets running requests finish first. Mizu automatically handles:
- Graceful shutdown when system signals are received
- Structured logging for startup and shutdown
- Panic recovery in handlers to prevent crashes
Health checks
You can add a health check endpoint for monitoring.This helps detect when the server is ready or shutting down.
200 OK when running and 503 Service Unavailable during shutdown.It works with load balancers and orchestration tools such as Kubernetes.