-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoc.go
More file actions
19 lines (19 loc) · 1.15 KB
/
Copy pathdoc.go
File metadata and controls
19 lines (19 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// httpx is a small helper library to work with Go's standard net/http package.
// The package is designed to be simple yet powerful, providing just the essential features
// needed for building HTTP APIs without the complexity of larger frameworks.
//
// The main asset of httpx is its error-returning handlers and middleware pattern.
// Instead of handling errors within each handler, errors are returned and managed
// centrally by a single errorHandler function. This dramatically reduces boilerplate
// error handling code in your handlers.
//
// The router and handler groups can be used standalone with the standard http.ListenAndServe
// or with the provided httpx.ListenAndServe function which includes graceful shutdown support.
//
// Key Features:
// - Error-returning handlers/middlewares: returns errors instead of handling them inline
// - Centralized error handling: All errors managed by a single errorHandler function
// - Route grouping: Organize routes with prefixes and shared middleware
// - Middleware chain: Composable middleware with Next() pattern
// - Graceful shutdown: Optional ListenAndServe with built-in signal handling
package httpx