Directory Layout
File Details
main.go
This is your entire application:go.mod
The Go module file defines your project:The version
v0.0.0 is a placeholder. When you run go mod tidy, it’s replaced with the actual latest version..gitignore
Tells Git which files to ignore:README.md
Basic project documentation:app.Get- Registers this handler for GET requests"/"- The URL path to matchfunc(c *mizu.Ctx) error- The handler functionc- The context, contains request info and response methodsc.Text(200, ...)- Send a text response with status 200
The Context
The*mizu.Ctx parameter gives you access to:
Starting the Server
":8080"means “listen on port 8080 on all interfaces”Listenblocks until the server is stopped- If it fails (port in use, etc.), we log the error and exit
Common Modifications
Change the Port
Add More Routes
Add URL Parameters
Handle POST Requests
When to Add More Structure
Signs you’ve outgrown the minimal template:- main.go is over 100 lines - Time to split into multiple files
- You have related routes - Group them into packages
- You need configuration - Add a config file/struct
- Multiple developers - Need clearer organization
api template or building your own structure.
Next Steps
Tutorial
Build your first app step by step
API Template
See a more structured approach