about summary refs log tree commit diff stats
path: root/cmd/server
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/server')
-rw-r--r--cmd/server/server.go21
1 files changed, 10 insertions, 11 deletions
diff --git a/cmd/server/server.go b/cmd/server/server.go
index 935cc1e..cc1821a 100644
--- a/cmd/server/server.go
+++ b/cmd/server/server.go
@@ -126,23 +126,22 @@ func main() {
 
 	website.Use(recover.New(recover.Config{}))
 
-	files := http.Dir("public")
-	notFoundHandler := func(c *fiber.Ctx) error {
+	prefix := "website/public"
+	publicFiles := http.Dir(prefix)
+	website.Use("/", filesystem.New(filesystem.Config{
+		Root:               publicFiles,
+		ContentTypeCharset: "utf-8",
+		MaxAge:             int((24 * time.Hour).Seconds()),
+	}))
+	website.Use(func(c *fiber.Ctx) error {
 		c.Status(fiber.StatusNotFound).Type("html", "utf-8")
-		content, err := files.Open("404.html")
+		content, err := os.Open("website/private/404.html")
 		if err != nil {
 			c.Type("txt")
 			return c.SendString("404 Not Found")
 		}
 		return c.SendStream(content)
-	}
-	website.Get("/404.html", notFoundHandler)
-	website.Use("/", filesystem.New(filesystem.Config{
-		Root:               files,
-		ContentTypeCharset: "utf-8",
-		MaxAge:             int((24 * time.Hour).Seconds()),
-	}))
-	website.Use(notFoundHandler)
+	})
 	hosts[runtimeConfig.BaseURL.Host] = &Host{website}
 
 	toplevel := fiber.New(fiber.Config{