feat: Update Fiber version to v2 and update internal controller and search logic to use new index module
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
Reference in New Issue
Block a user