Add package-level doc comments for go doc and gopls
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
38
server/doc.go
Normal file
38
server/doc.go
Normal file
@@ -0,0 +1,38 @@
|
||||
// Package server provides a production-ready HTTP server with graceful
|
||||
// shutdown, middleware composition, routing, and JSON response helpers.
|
||||
//
|
||||
// # Server
|
||||
//
|
||||
// Server wraps http.Server with net.Listener, signal-based graceful shutdown
|
||||
// (SIGINT/SIGTERM), and lifecycle hooks. It is configured via functional options:
|
||||
//
|
||||
// srv := server.New(handler,
|
||||
// server.WithAddr(":8080"),
|
||||
// server.Defaults(logger),
|
||||
// )
|
||||
// srv.ListenAndServe()
|
||||
//
|
||||
// # Router
|
||||
//
|
||||
// Router wraps http.ServeMux with middleware groups, prefix-based route groups,
|
||||
// and sub-handler mounting. It supports Go 1.22+ method-based patterns:
|
||||
//
|
||||
// r := server.NewRouter()
|
||||
// r.HandleFunc("GET /users/{id}", getUser)
|
||||
//
|
||||
// api := r.Group("/api/v1", authMiddleware)
|
||||
// api.HandleFunc("GET /items", listItems)
|
||||
//
|
||||
// # Middleware
|
||||
//
|
||||
// Server middleware follows the func(http.Handler) http.Handler pattern.
|
||||
// Available middleware: RequestID, Recovery, Logging, CORS, RateLimit,
|
||||
// MaxBodySize, Timeout. Use Chain to compose them:
|
||||
//
|
||||
// chain := server.Chain(server.RequestID(), server.Recovery(logger), server.Logging(logger))
|
||||
//
|
||||
// # Response helpers
|
||||
//
|
||||
// WriteJSON and WriteError provide JSON response writing with proper
|
||||
// Content-Type headers.
|
||||
package server
|
||||
Reference in New Issue
Block a user