diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2025-10-02 19:33:20 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2025-10-02 19:33:20 +0200 |
| commit | c000d9482e183f74b6237ecaeb7f06c0862413de (patch) | |
| tree | 96d36e872f7e3826692f8b11d6152834bf90ba57 /backend/logs.go | |
| parent | 0ec5a0769f3c2dc851948a1011fa9062ff5c657b (diff) | |
feat(backend): handle log
Diffstat (limited to 'backend/logs.go')
| -rw-r--r-- | backend/logs.go | 45 |
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) +} |
