diff --git a/routes/route.go b/routes/route.go index 468ee32..eddc3f7 100644 --- a/routes/route.go +++ b/routes/route.go @@ -3,7 +3,6 @@ package routes import ( "Ahmedhossamdev/search-engine/views" "fmt" - "time" "github.com/a-h/templ" "github.com/gofiber/fiber/v2" @@ -26,22 +25,40 @@ type loginForm struct { Password string `form:"password"` } +type settingsForm struct { + Amount int `form:"amount"` + SearchOn bool `form:"searchOn"` + AddNew bool `form:"addNew"` +} + + + func SetRoutes(app *fiber.App) { app.Get("/", func(c *fiber.Ctx) error { return render(c, views.Home()) }) + + app.Post("/", func(c *fiber.Ctx) error { + input := settingsForm{} + if err := c.BodyParser(&input); err != nil { + return c.SendString("