chore: custom error

This commit is contained in:
2026-03-02 22:38:28 +01:00
parent 6c1387c1cd
commit 2491d21963
19 changed files with 363 additions and 60 deletions
+27
View File
@@ -0,0 +1,27 @@
package resthome
import (
"context"
"net/http"
"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/components/page"
)
type Handler struct {
src pageService
}
func New(mux *http.ServeMux, srv pageService) *Handler {
h := &Handler{
src: srv,
}
mux.HandleFunc("GET /{$}", h.home)
mux.HandleFunc("GET /{uid}", h.page)
return h
}
type pageService interface {
GetPages(ctx context.Context) ([]page.PageHeader, error)
GetPage(ctx context.Context, uid string) (page.Page, error)
}