feat: Create collection file for routes

This commit is contained in:
Björn Benouarets
2025-08-11 22:15:32 +02:00
commit f00ecb8155
14 changed files with 482 additions and 0 deletions

24
server/route.go Normal file
View File

@@ -0,0 +1,24 @@
package server
import (
"encoding/json"
"net/http"
)
func (api *ApiServer) HealthCheckRoute(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
response := HealthCheckResponse{
Database: api.DatabaseConnection.Ping(),
API: true,
Status: "OK",
}
err := json.NewEncoder(w).Encode(response)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
_, err := w.Write([]byte("Internal Server Error"))
if err != nil {
return
}
}
}