mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-11-22 00:36:20 +03:00
api compactification
This commit is contained in:
parent
fc90a725b1
commit
5e1dc9d5c5
1 changed files with 10 additions and 8 deletions
18
main.go
18
main.go
|
@ -11,16 +11,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
go functions.Logger("EveryNasa started")
|
||||||
go functions.Database()
|
go functions.Database()
|
||||||
go systray.Run(functions.Tray, functions.Quit)
|
go systray.Run(functions.Tray, functions.Quit)
|
||||||
go functions.StartWallpaper()
|
go functions.StartWallpaper()
|
||||||
|
|
||||||
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./web/static"))))
|
|
||||||
|
|
||||||
http.HandleFunc("/", page.GalleryHandler)
|
|
||||||
http.HandleFunc("/settings", page.SettingsHandler)
|
|
||||||
http.HandleFunc("/about", page.AboutHandler)
|
|
||||||
|
|
||||||
router := mux.NewRouter()
|
router := mux.NewRouter()
|
||||||
router.Use(func(next http.Handler) http.Handler {
|
router.Use(func(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -31,12 +26,19 @@ func main() {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("./web/static"))))
|
||||||
|
|
||||||
|
http.HandleFunc("/", page.GalleryHandler)
|
||||||
|
http.HandleFunc("/settings", page.SettingsHandler)
|
||||||
|
http.HandleFunc("/about", page.AboutHandler)
|
||||||
|
|
||||||
router.HandleFunc("/api/get/settings", controllers.SettingsGet).Methods("GET")
|
router.HandleFunc("/api/get/settings", controllers.SettingsGet).Methods("GET")
|
||||||
router.HandleFunc("/api/get/version", controllers.Version).Methods("GET")
|
router.HandleFunc("/api/get/version", controllers.Version).Methods("GET")
|
||||||
|
|
||||||
router.HandleFunc("/api/update/settings", controllers.SettingsUpdate).Methods("POST")
|
router.HandleFunc("/api/update/settings", controllers.SettingsUpdate).Methods("POST")
|
||||||
router.HandleFunc("/api/update/wallpaper", controllers.WallpaperUpdate).Methods("POST")
|
router.HandleFunc("/api/update/wallpaper", controllers.WallpaperUpdate).Methods("POST")
|
||||||
router.HandleFunc("/api/update/set/startup", controllers.SetStartup).Methods("POST")
|
router.HandleFunc("/api/update/startup", controllers.Startup).Methods("POST")
|
||||||
router.HandleFunc("/api/update/del/startup", controllers.RemoveStartup).Methods("POST")
|
router.HandleFunc("/api/create/label", controllers.CreateLabel).Methods("POST")
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
err := http.ListenAndServe(":4662", nil)
|
err := http.ListenAndServe(":4662", nil)
|
||||||
|
|
Loading…
Add table
Reference in a new issue