File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package web
22
33import (
4+ "io"
45 "io/fs"
56 "net/http"
67 "os"
@@ -16,6 +17,7 @@ import (
1617 "github.com/theandrew168/bloggulus/backend/repository"
1718 "github.com/theandrew168/bloggulus/backend/service"
1819 "github.com/theandrew168/bloggulus/backend/web/middleware"
20+ "github.com/theandrew168/bloggulus/backend/web/ui"
1921 "github.com/theandrew168/bloggulus/backend/web/util"
2022)
2123
@@ -135,6 +137,13 @@ func Handler(
135137 http .Redirect (w , r , "/" , http .StatusSeeOther )
136138 })
137139
140+ mux .HandleFunc ("GET /gomp" , func (w http.ResponseWriter , r * http.Request ) {
141+ page := ui .Layout (ui.LayoutData {})
142+ util .Render (w , r , http .StatusOK , func (w io.Writer ) error {
143+ return page .Render (w )
144+ })
145+ })
146+
138147 // Requests that don't match any of the above handlers get a 404.
139148 mux .HandleFunc ("/" , func (w http.ResponseWriter , r * http.Request ) {
140149 util .NotFoundResponse (w , r )
Original file line number Diff line number Diff line change 1+ package ui
2+
3+ import (
4+ "github.com/theandrew168/bloggulus/backend/model"
5+
6+ . "maragu.dev/gomponents"
7+ . "maragu.dev/gomponents/components"
8+ . "maragu.dev/gomponents/html"
9+ )
10+
11+ type LayoutData struct {
12+ Account * model.Account
13+ CSRFToken string
14+ Toast string
15+
16+ GoatCounterCode string
17+ PlausibleDataDomain string
18+ }
19+
20+ func Layout (data LayoutData ) Node {
21+ return HTML5 (HTML5Props {
22+ Language : "en" ,
23+ Title : "Bloggulus - A website for avid blog readers" ,
24+ Description : "Bloggulus - A website for avid blog readers" ,
25+ Head : []Node {},
26+ Body : []Node {
27+ Div (Text ("wow" )),
28+ },
29+ })
30+ }
Original file line number Diff line number Diff line change @@ -41,4 +41,5 @@ require (
4141 golang.org/x/sys v0.31.0 // indirect
4242 golang.org/x/text v0.23.0 // indirect
4343 google.golang.org/protobuf v1.36.5 // indirect
44+ maragu.dev/gomponents v1.1.0 // indirect
4445)
Original file line number Diff line number Diff line change @@ -154,3 +154,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
154154gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c /go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM =
155155gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA =
156156gopkg.in/yaml.v3 v3.0.1 /go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM =
157+ maragu.dev/gomponents v1.1.0 h1:iCybZZChHr1eSlvkWp/JP3CrZGzctLudQ/JI3sBcO4U =
158+ maragu.dev/gomponents v1.1.0 /go.mod h1:oEDahza2gZoXDoDHhw8jBNgH+3UR5ni7Ur648HORydM =
You can’t perform that action at this time.
0 commit comments