How maruki00/azago works
Project Type and Purpose
• This is a stand-alone Go HTTP server application (“go-webserver”) with its own minimal framework (under internal/azago) and several reusable helper packages (under pkg).
• It listens for incoming HTTP requests, routes them to handlers, applies middleware (gzip compression, logging, etc.), and sends back responses.
File Structure
• cmd/main.go
• Entry point; constructs and starts the server.
• internal/azago
• Core web framework:
– server.go: HTTP server bootstrapping
– router.go: route registration and dispatch
– request.go / response.go: abstractions over net/http Request/ResponseWriter
– zenith_ctx.go: per-request context management
• internal/common
• pkg/
• gzip/gzip.go: middleware for GZIP compression
• log/logs.go: structured logging
• reader/reader.go: body-parsing utilities
• time/time.go: time-related helpers
Key Architectural Patterns
• Layered HTTP handling: middleware chain → router → handler
• Dependency inversion: internal/azago defines interfaces (Request, Response, Router) that higher layers use.
• Separation of concerns: internal/azago for framework, pkg/* for reusable libraries, internal/common for shared utilities.
Main Components
a. External Clients (Browsers or API callers)
b. go-webserver Binary (cmd/main.go)
c. HTTP Server (internal/azago/server)
d. Middleware Layer
– gzip (pkg/gzip)
– logging (pkg/log)
– request reader (pkg/reader)
– time util (pkg/time)
e. Router (internal/azago/router) → dispatch to handlers
f. Request/Response abstractions (internal/azago/request & response)
g. Shared Utilities (internal/common)
Relationships and Data Flow
1. Client issues HTTP request → TCP → Server.Listen (server.go)
2. Incoming request wrapped into azago.Request
3. Pass through middleware chain (gzip, log, reader, time); each middleware mutates context or response headers
4. Routed by azago.Router to a handler function
5. Handler uses common utilities (internal/common) and writes to azago.Response
6. Response passes back through any post-processing middleware (e.g., gzip compression)
7. Final HTTP response sent to client
Technologies and Frameworks
• Go standard library (net/http) under the hood
• Custom mini-framework (internal/azago)
• Reusable Go modules in pkg/