api/internal/handler/visitor.go
2024-09-25 18:22:51 +01:00

21 lines
487 B
Go

package handler
import (
"backend/internal/service"
"encoding/json"
"net/http"
)
func HandleGetVisitorCounter(w http.ResponseWriter, r *http.Request) {
data := service.GetVisitorCounter()
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
}
func HandlePatchVisitorCounter(w http.ResponseWriter, r *http.Request) {
data := service.IncrementVisitorCounter()
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
}