feat: test page
This commit is contained in:
@@ -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>
|
||||
}
|
||||
|
||||
@@ -4,4 +4,6 @@ import (
|
||||
"forge.capytal.company/capytalcode/project-comicverse/router"
|
||||
)
|
||||
|
||||
var PAGES = []router.Route{}
|
||||
var PAGES = []router.Route{
|
||||
{Pattern: "/dashboard", Handler: &Dashboard{}},
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user