mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-12-24 17:33:45 +03:00
Delete main.go
This commit is contained in:
parent
3a0e41a393
commit
ef26347bc5
1 changed files with 0 additions and 79 deletions
79
main.go
79
main.go
|
@ -1,79 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/Redume/EveryNasa/api/controllers"
|
||||
"github.com/Redume/EveryNasa/functions"
|
||||
"github.com/Redume/EveryNasa/web/page"
|
||||
"github.com/getlantern/systray"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/gofiber/fiber/v2/middleware/cors"
|
||||
)
|
||||
|
||||
func main() {
|
||||
go functions.Database()
|
||||
go systray.Run(functions.Tray, functions.Quit)
|
||||
go functions.StartWallpaper()
|
||||
|
||||
app := fiber.New()
|
||||
app = fiber.New(fiber.Config{
|
||||
ErrorHandler: func(ctx *fiber.Ctx, err error) error {
|
||||
code := fiber.StatusInternalServerError
|
||||
|
||||
if e, ok := err.(*fiber.Error); ok {
|
||||
code = e.Code
|
||||
}
|
||||
|
||||
if code == fiber.StatusNotFound {
|
||||
return ctx.SendFile("./web/errors/404.html")
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
})
|
||||
|
||||
app.Static("/static", "./web/static")
|
||||
app.Use(cors.New())
|
||||
|
||||
app.Get("/", func(c *fiber.Ctx) error {
|
||||
return page.Gallery(c)
|
||||
})
|
||||
app.Get("/settings", func(c *fiber.Ctx) error {
|
||||
return page.Settings(c)
|
||||
})
|
||||
app.Get("/about", func(c *fiber.Ctx) error {
|
||||
return page.About(c)
|
||||
})
|
||||
|
||||
api := app.Group("/api")
|
||||
|
||||
update := api.Group("/update")
|
||||
get := api.Group("/get")
|
||||
create := api.Group("/create")
|
||||
|
||||
update.Post("/settings", func(c *fiber.Ctx) error {
|
||||
return controllers.SettingsUpdate(c)
|
||||
})
|
||||
update.Post("/wallpaper", func(c *fiber.Ctx) error {
|
||||
return controllers.WallpaperUpdate(c)
|
||||
})
|
||||
update.Post("/startup", func(c *fiber.Ctx) error {
|
||||
return controllers.Startup(c)
|
||||
})
|
||||
|
||||
create.Post("/label", func(c *fiber.Ctx) error {
|
||||
return controllers.CreateLabel(c)
|
||||
})
|
||||
|
||||
get.Get("/settings", func(c *fiber.Ctx) error {
|
||||
return controllers.SettingsGet(c)
|
||||
})
|
||||
|
||||
get.Get("/settings", func(c *fiber.Ctx) error {
|
||||
return controllers.SettingsGet(c)
|
||||
})
|
||||
|
||||
err := app.Listen(":3000")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue