From 253988c4eb904f7f98f7641fa07daf6f63d6ec27 Mon Sep 17 00:00:00 2001 From: Redume Date: Sun, 18 Sep 2022 19:28:19 +0300 Subject: [PATCH] page handler --- web/pages/about.go | 7 +++++++ web/pages/index.go | 22 ++++++++++++++++++++++ web/pages/settings.go | 7 +++++++ 3 files changed, 36 insertions(+) create mode 100644 web/pages/about.go create mode 100644 web/pages/index.go create mode 100644 web/pages/settings.go diff --git a/web/pages/about.go b/web/pages/about.go new file mode 100644 index 0000000..67391c0 --- /dev/null +++ b/web/pages/about.go @@ -0,0 +1,7 @@ +package page + +import "net/http" + +func AboutHandler(w http.ResponseWriter, r *http.Request) { + http.ServeFile(w, r, "web/src/about.html") +} diff --git a/web/pages/index.go b/web/pages/index.go new file mode 100644 index 0000000..de2e3b6 --- /dev/null +++ b/web/pages/index.go @@ -0,0 +1,22 @@ +package page + +import ( + "net/http" + + "github.com/Redume/EveryNasa/functions" +) + +func GalleryHandler(w http.ResponseWriter, r *http.Request) { + con := functions.Connected() + if con == false { + http.ServeFile(w, r, "web/src/errors/504.html") + return + } + + if r.URL.Path != "/" { + http.ServeFile(w, r, "web/src/errors/404.html") + return + } + + http.ServeFile(w, r, "web/src/gallery.html") +} diff --git a/web/pages/settings.go b/web/pages/settings.go new file mode 100644 index 0000000..987368c --- /dev/null +++ b/web/pages/settings.go @@ -0,0 +1,7 @@ +package page + +import "net/http" + +func SettingsHandler(w http.ResponseWriter, r *http.Request) { + http.ServeFile(w, r, "web/src/settings.html") +}