diff --git a/pages/dashboard.templ b/pages/dashboard.templ index 285e903..ffffc8c 100644 --- a/pages/dashboard.templ +++ b/pages/dashboard.templ @@ -1,10 +1,23 @@ package pages -type Dashboard struct {} +import ( + "net/http" -func (p *Dashboard) ServeHTTP() { + "forge.capytal.company/capytalcode/project-comicverse/router/rerrors" +) + +type Dashboard struct{} + +func (p *Dashboard) ServeHTTP(w http.ResponseWriter, r *http.Request) { + if err := p.Component().Render(r.Context(), w); err != nil { + rerrors.InternalError(err).ServeHTTP(w, r) + return + } + w.WriteHeader(http.StatusOK) } templ (p *Dashboard) Component() { - +
+

Hello world

+
} diff --git a/pages/routes.go b/pages/routes.go index 63a22b3..142a78b 100644 --- a/pages/routes.go +++ b/pages/routes.go @@ -4,4 +4,6 @@ import ( "forge.capytal.company/capytalcode/project-comicverse/router" ) -var PAGES = []router.Route{} +var PAGES = []router.Route{ + {Pattern: "/dashboard", Handler: &Dashboard{}}, +} diff --git a/router/router.go b/router/router.go index 5f0085c..68bf515 100644 --- a/router/router.go +++ b/router/router.go @@ -18,8 +18,8 @@ type RouterOpts struct { } type Route struct { - pattern string - handler http.Handler + Pattern string + Handler http.Handler } func NewRouter(opts ...RouterOpts) *Router {