28 lines
576 B
Go
28 lines
576 B
Go
package routes
|
|
|
|
import (
|
|
"log/slog"
|
|
"net/http"
|
|
|
|
"gitea.henriburau.de/haw-lan/cod4watcher/services"
|
|
"github.com/a-h/templ"
|
|
)
|
|
|
|
type HTTPHandler func(w http.ResponseWriter, r *http.Request) error
|
|
|
|
func Make(h HTTPHandler) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
if err := h(w, r); err != nil {
|
|
slog.Error("HTTP handler error", "err", err, "path", r.URL.Path)
|
|
}
|
|
}
|
|
}
|
|
|
|
type Server struct {
|
|
cs *services.CaptureService
|
|
}
|
|
|
|
func Render(w http.ResponseWriter, r *http.Request, c templ.Component) error {
|
|
return c.Render(r.Context(), w)
|
|
}
|