feat: healthcheck backend and fix data types
also small various features
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user