Initial commit

This commit is contained in:
Henri Burau
2024-06-03 18:07:27 +02:00
commit ca04cc51f3
43 changed files with 4440 additions and 0 deletions

24
routes/capture.go Normal file
View File

@ -0,0 +1,24 @@
package routes
import (
"net/http"
"strconv"
"gitea.henriburau.de/haw-lan/cod4watcher/views/capture"
"github.com/go-chi/chi"
)
func (s *Server) HandleCapture(w http.ResponseWriter, r *http.Request) error {
captureString := chi.URLParam(r, "captureID")
captureID, err := strconv.Atoi(captureString)
if err != nil {
return err
}
foundCapture, err := s.cs.GetCaptureById(captureID)
if err != nil {
return err
}
return Render(w, r, capture.Capture(foundCapture))
}