aboutsummaryrefslogtreecommitdiff
path: root/backend/logs.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/logs.go')
-rw-r--r--backend/logs.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/backend/logs.go b/backend/logs.go
new file mode 100644
index 0000000..f3a2e5c
--- /dev/null
+++ b/backend/logs.go
@@ -0,0 +1,45 @@
+package backend
+
+import (
+ "net/http"
+
+ "github.com/go-chi/chi/v5"
+)
+
+type logData struct {
+ *data
+ LogTitle string
+ Description string
+ Img image
+}
+
+func (d *logData) SetData(dt *data) {
+ d.data = dt
+}
+
+type image struct {
+ Src string
+ Alt string
+ Legend string
+}
+
+func HandleLogs(r *chi.Mux) {
+ r.Route("/logs", func(r chi.Router) {
+ r.Get("/", handleLogList)
+ r.Get("/{slug:[a-zA-Z0-9-]+}", handleLog)
+ })
+}
+
+func handleLogList(w http.ResponseWriter, r *http.Request) {
+
+}
+
+func handleLog(w http.ResponseWriter, r *http.Request) {
+ slug := chi.URLParam(r, "slug")
+ d := new(logData)
+ d.data = new(data)
+ d.Article = true
+ d.LogTitle = slug
+ d.title = slug
+ d.handleGeneric(w, r, "log", d)
+}