feat: test page

This commit is contained in:
Guz
2024-10-07 19:12:27 -03:00
parent f1d312bfce
commit 34c6b7ccb4
3 changed files with 21 additions and 6 deletions

View File

@@ -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() {
<div class="text-red">
<p>Hello world</p>
</div>
}

View File

@@ -4,4 +4,6 @@ import (
"forge.capytal.company/capytalcode/project-comicverse/router"
)
var PAGES = []router.Route{}
var PAGES = []router.Route{
{Pattern: "/dashboard", Handler: &Dashboard{}},
}

View File

@@ -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 {