5dbd71307f
Tres tipos Go en el paquete infra para construir servidores HTTP: - Middleware: funcion que envuelve http.Handler (patron decorator) - Route: struct con Method, Path y Handler para registrar rutas - HTTPError: struct con Status, Code y Message para respuestas JSON de error Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
11 lines
309 B
Go
11 lines
309 B
Go
package infra
|
|
|
|
import "net/http"
|
|
|
|
// Route define una ruta HTTP con metodo, path y handler.
|
|
type Route struct {
|
|
Method string // metodo HTTP (GET, POST, PUT, DELETE, PATCH, etc.)
|
|
Path string // path de la ruta (ej: /api/users/{id})
|
|
Handler http.Handler // handler que procesa la peticion
|
|
}
|