feat: Update Fiber version to v2 and update internal controller and search logic to use new index module

This commit is contained in:
2025-03-25 21:09:01 +01:00
parent 8746f789c4
commit ed201de318
9 changed files with 85 additions and 62 deletions

View File

@@ -2,24 +2,23 @@ package http
import (
"git.dev-null.rocks/alexohneander/gosearch/internal/controller"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/middleware/healthcheck"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/monitor"
)
func configureRoutes(app *fiber.App) *fiber.App {
// Index
app.Get("/", controller.Index)
app.Get("/test", controller.Index)
app.Post("/api/index", controller.AddDocumentToIndex)
// Search
app.Get("/api/search/:query", controller.SearchQuery)
// Monitor
// app.Get("/metrics", monitor.New(monitor.Config{Title: "MyService Metrics Page"}))
app.Get("/metrics", monitor.New(monitor.Config{Title: "gosearch Metrics"}))
// Health Checks
app.Get(healthcheck.DefaultLivenessEndpoint, healthcheck.NewHealthChecker())
app.Get(healthcheck.DefaultReadinessEndpoint, healthcheck.NewHealthChecker())
app.Get(healthcheck.DefaultStartupEndpoint, healthcheck.NewHealthChecker())
// app.Get(healthcheck.DefaultLivenessEndpoint, healthcheck.NewHealthChecker())
// app.Get(healthcheck.DefaultReadinessEndpoint, healthcheck.NewHealthChecker())
// app.Get(healthcheck.DefaultStartupEndpoint, healthcheck.NewHealthChecker())
return app
}