From 393f6de5b660c842e0721e4bc089c48f3a110d57 Mon Sep 17 00:00:00 2001 From: samantha42 Date: Tue, 19 May 2026 22:11:44 +0200 Subject: [PATCH] new html design --- main.go | 32 +++++++--------- static/about.html | 91 +++++++++++++++++++++++---------------------- static/cinema.html | 2 +- static/cyber.html | 2 +- static/engine.html | 2 +- static/finance.html | 2 +- static/infra.html | 2 +- static/styles2.css | 56 +++++++++++++++++----------- 8 files changed, 100 insertions(+), 89 deletions(-) diff --git a/main.go b/main.go index 212f9bb..89e72cf 100644 --- a/main.go +++ b/main.go @@ -21,18 +21,11 @@ func HelloHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "Hello You") } -func Home(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/index.html") } -func Infra(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/infra.html") } -func Finance(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/finance.html") } -func Cinema(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/cinema.html") } -func Engine(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/engine.html") } -func Portfolio(w http.ResponseWriter, r *http.Request) { - http.ServeFile(w, r, "./static/portfolio.html") +func staticPage(path, file string) { + http.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) { + http.ServeFile(w, r, "./static/"+file) + }) } -func About(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/about.html") } - -func Styles(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/styles.css") } -func Styles2(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "./static/styles2.css") } // ---------- Main ---------- @@ -40,21 +33,22 @@ func main() { port := flag.String("port", "8081", "port to listen on") flag.Parse() - http.HandleFunc("/styles.css", Styles) - http.HandleFunc("/styles2.css", Styles2) + fs := http.FileServer(http.Dir("static")) + http.Handle("/static/", http.StripPrefix("/static/", fs)) + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { if r.URL.Path != "/" { http.Redirect(w, r, "/", http.StatusFound) return } - About(w, r) + http.ServeFile(w, r, "./static/about.html") }) //http.HandleFunc("/portfolio", Portfolio) - http.HandleFunc("/infra", Infra) - http.HandleFunc("/finance", Finance) - http.HandleFunc("/cinema", Cinema) - http.HandleFunc("/engine", Engine) - http.HandleFunc("/portfolio", Portfolio) + staticPage("/infra", "infra.html") + staticPage("/finance", "finance.html") + staticPage("/cinema", "cinema.html") + staticPage("/engine", "engine.html") + //http.HandleFunc("/portfolio", Portfolio) http.HandleFunc("/git", func(w http.ResponseWriter, r *http.Request) { http.Redirect(w, r, "https://git.samantha42.xyz", http.StatusFound) }) diff --git a/static/about.html b/static/about.html index cfca9df..4d65fec 100644 --- a/static/about.html +++ b/static/about.html @@ -6,7 +6,7 @@ Samantha Vero Friis - + @@ -149,56 +149,59 @@

Movie/Show Top list

- +

Top 5 Movies

-
    -
  1. - Blade Runner 2049 - -
  2. -
  3. A Cure of Wellness - -
  4. - -
  5. Fight Club - -
  6. -
  7. Dracula: A Love Tale - -
  8. -
  9. Girl with a Dragon Tattoo - -
  10. -
+
+
+ Blade Runner 2049 +

Blade Runner 2049

+
+
+ A Cure of Wellness +

A Cure of Wellness

+
+
+ Fight Club +

Fight Club

+
+
+ Dracula: A Love Tale +

Dracula: A Love Tale

+
+
+ Girl with a Dragon Tattoos +

Girl with a Dragon Tattoo

+
- -
-
    -
  1. Chernobyl - -
  2. -
  3. Succession - -
  4. -
  5. Breaking Bad - -
  6. -
  7. Avatar: The Last Airbender - -
  8. -
  9. Adolescence - -
  10. -
+

Top 5 Shows

+
+
+
+ Chernobyl +

Chernobyl

+
+
+ Succession +

Succession

+
+
+ Breaking Bad +

Breaking Bad

+
+
+ Avatar: The Last Airbender +

Avatar: The Last Airbender

+
+
+ Adolescence +

Adolescence

+
+
diff --git a/static/cinema.html b/static/cinema.html index 62da42f..1c1a40c 100644 --- a/static/cinema.html +++ b/static/cinema.html @@ -8,7 +8,7 @@ href="https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Syne:wght@400;700;800&display=swap" rel="stylesheet" /> - +
diff --git a/static/cyber.html b/static/cyber.html index b3595af..0972a1f 100644 --- a/static/cyber.html +++ b/static/cyber.html @@ -8,7 +8,7 @@ href="https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Syne:wght@400;700;800&display=swap" rel="stylesheet" /> - +
diff --git a/static/engine.html b/static/engine.html index cf6e379..e901ed0 100644 --- a/static/engine.html +++ b/static/engine.html @@ -6,7 +6,7 @@ FP&A Budgeting Engine — Samantha Vero Friis - +