From 373eb6d3248432b9ebce287a5b3a6d06af24f0a6 Mon Sep 17 00:00:00 2001 From: skidoodle Date: Sun, 15 Jun 2025 01:07:02 +0200 Subject: [PATCH] Refactor web assets structure; migrate HTML, CSS, and JS to new directory and update Dockerfile for new paths --- Dockerfile | 2 +- main.go | 4 +--- index.html => web/index.html | 0 script.js => web/script.js | 0 style.css => web/style.css | 0 5 files changed, 2 insertions(+), 4 deletions(-) rename index.html => web/index.html (100%) rename script.js => web/script.js (100%) rename style.css => web/style.css (100%) diff --git a/Dockerfile b/Dockerfile index 793e12c..c856520 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ FROM alpine:3 RUN apk add --no-cache ca-certificates WORKDIR /app COPY --from=builder /out/ncore-stats . -COPY index.html style.css script.js ./ +COPY web ./web EXPOSE 3000 CMD ["./ncore-stats"] diff --git a/main.go b/main.go index 73dd72f..89f0add 100644 --- a/main.go +++ b/main.go @@ -90,9 +90,7 @@ func main() { router := http.NewServeMux() router.HandleFunc("/api/profiles", state.profilesHandler) router.HandleFunc("/api/history", state.historyHandler) - router.HandleFunc("/", serveStatic("index.html", "text/html")) - router.HandleFunc("/style.css", serveStatic("style.css", "text/css")) - router.HandleFunc("/script.js", serveStatic("script.js", "application/javascript")) + router.Handle("/", http.FileServer(http.Dir("web"))) server := &http.Server{ Addr: config.ServerPort, diff --git a/index.html b/web/index.html similarity index 100% rename from index.html rename to web/index.html diff --git a/script.js b/web/script.js similarity index 100% rename from script.js rename to web/script.js diff --git a/style.css b/web/style.css similarity index 100% rename from style.css rename to web/style.css