From 5f41bfcc789f3a38c4910c96588af14710133347 Mon Sep 17 00:00:00 2001 From: Redume Date: Thu, 15 Dec 2022 21:08:15 +0300 Subject: [PATCH] After launching the application, the UI opens automatically. --- main.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/main.go b/main.go index 6a9bd9d..45e940d 100644 --- a/main.go +++ b/main.go @@ -7,9 +7,11 @@ import ( "github.com/getlantern/systray" "github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2/middleware/cors" + "github.com/skratchdot/open-golang/open" ) func main() { + go open.Run("http://localhost:3000") go functions.Database() go systray.Run(functions.Tray, functions.Quit) go functions.StartWallpaper() @@ -43,11 +45,16 @@ func main() { app.Get("/about", func(c *fiber.Ctx) error { return page.About(c) }) + app.Get("/favorite", func(c *fiber.Ctx) error { + return page.Favorite(c) + }) api := app.Group("/api") update := api.Group("/update") get := api.Group("/get") + add := api.Group("/add") + del := api.Group("/del") create := api.Group("/create") update.Post("/settings", func(c *fiber.Ctx) error { @@ -68,6 +75,18 @@ func main() { return controllers.SettingsGet(c) }) + get.Get("/favorites", func(c *fiber.Ctx) error { + return controllers.GetFavorites(c) + }) + + add.Post("/favorite", func(c *fiber.Ctx) error { + return controllers.AddFavorite(c) + }) + + del.Post("/favorite", func(c *fiber.Ctx) error { + return controllers.DeleteFavorite(c) + }) + err := app.Listen(":3000") if err != nil { return