installed gin

This commit is contained in:
2026-01-13 22:07:20 -07:00
parent 851234d9fa
commit 7481cec0d5
29 changed files with 544 additions and 1094 deletions
+7 -7
View File
@@ -1,22 +1,22 @@
package response
import (
"net/http"
"github.com/gin-gonic/gin"
)
type (
HandlerFunc = func(r *http.Request) (Response, error)
HandlerFunc = func(c *gin.Context) (Response, error)
Middleware = func(HandlerFunc) HandlerFunc
)
func Handler(f HandlerFunc) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
res, err := f(r)
func Handler(f HandlerFunc) gin.HandlerFunc {
return func(c *gin.Context) {
res, err := f(c)
if err != nil {
WriteError(w, err)
WriteError(c, err)
} else {
Write(w, r, res)
Write(c, res)
}
}
}