feat: healthcheck backend and fix data types

also small various features
This commit is contained in:
kilyabin
2026-04-28 00:10:06 +04:00
parent 1cb93a1f31
commit 78e5c90ed0
9 changed files with 305 additions and 132 deletions
+6 -1
View File
@@ -2,6 +2,7 @@ package api
import (
"fmt"
"net/http"
"dip-ids/internal/analyzer"
"dip-ids/internal/api/handlers"
@@ -27,7 +28,7 @@ func New(
r.Use(gin.Recovery())
r.Use(corsMiddleware())
r.Use(gin.LoggerWithConfig(gin.LoggerConfig{
SkipPaths: []string{"/api/capture/status"},
SkipPaths: []string{"/api/capture/status", "/api/health"},
}))
alertsH := handlers.NewAlertsHandler(db)
@@ -37,6 +38,10 @@ func New(
api := r.Group("/api")
api.GET("/health", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"ok": true})
})
api.GET("/alerts", alertsH.GetAlerts)
api.DELETE("/alerts", alertsH.ClearAlerts)
api.DELETE("/alerts/:id", alertsH.DeleteAlert)