change name folder, project file optimization

This commit is contained in:
Данил 2023-03-18 16:49:04 +03:00
parent dfa190056e
commit b72629c751
No known key found for this signature in database
GPG key ID: 5051BCD5AB064A7B

28
main.go
View file

@ -2,8 +2,7 @@ package main
import ( import (
"github.com/Redume/EveryNasa/api/controllers" "github.com/Redume/EveryNasa/api/controllers"
"github.com/Redume/EveryNasa/functions" "github.com/Redume/EveryNasa/utils"
"github.com/Redume/EveryNasa/web/page"
"github.com/getlantern/systray" "github.com/getlantern/systray"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors" "github.com/gofiber/fiber/v2/middleware/cors"
@ -12,11 +11,12 @@ import (
func main() { func main() {
go open.Run("http://localhost:3000") go open.Run("http://localhost:3000")
go functions.Database() go utils.Database()
go systray.Run(functions.Tray, functions.Quit) go systray.Run(utils.Tray, utils.Quit)
go functions.StartWallpaper() go utils.StartWallpaper()
app := fiber.New() app := fiber.New()
app = fiber.New(fiber.Config{ app = fiber.New(fiber.Config{
ErrorHandler: func(ctx *fiber.Ctx, err error) error { ErrorHandler: func(ctx *fiber.Ctx, err error) error {
code := fiber.StatusInternalServerError code := fiber.StatusInternalServerError
@ -37,16 +37,26 @@ func main() {
app.Use(cors.New()) app.Use(cors.New())
app.Get("/", func(c *fiber.Ctx) error { app.Get("/", func(c *fiber.Ctx) error {
return page.Gallery(c) con := utils.Connected()
if con == false {
return c.SendFile("./web/errors/500.html")
}
return c.SendFile("./web/page/gallery.html")
}) })
app.Get("/settings", func(c *fiber.Ctx) error { app.Get("/settings", func(c *fiber.Ctx) error {
return page.Settings(c) con := utils.Connected()
if con == false {
return c.SendFile("./web/errors/500.html")
}
return c.SendFile("./web/page/settings.html")
}) })
app.Get("/about", func(c *fiber.Ctx) error { app.Get("/about", func(c *fiber.Ctx) error {
return page.About(c) return c.SendFile("./web/page/about.html")
}) })
app.Get("/favorite", func(c *fiber.Ctx) error { app.Get("/favorite", func(c *fiber.Ctx) error {
return page.Favorite(c) return c.SendFile("./web/page/favorite.html")
}) })
api := app.Group("/api") api := app.Group("/api")