aboutsummaryrefslogtreecommitdiff
path: root/backend/logs.go
blob: f3a2e5c01f8d2ba2667da4d183bddc4be57c6d3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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)
}