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

@@ -1,9 +1,23 @@
package controller
import (
"github.com/gofiber/fiber/v3"
"git.dev-null.rocks/alexohneander/gosearch/pkg/index"
"github.com/gofiber/fiber/v2"
)
func Index(c fiber.Ctx) error {
return c.SendString("Hello, World!")
type Document struct {
Url string `json:"url" xml:"url" form:"url"`
Content string `json:"content" xml:"content" form:"content"`
}
func AddDocumentToIndex(c *fiber.Ctx) error {
doc := new(Document)
if err := c.BodyParser(doc); err != nil {
return err
}
index.AddDocToIndex(doc.Url, doc.Content)
return c.SendString("Document added")
}