From 22e9ca4503af5e2a9ad8b0e77474989d802b0755 Mon Sep 17 00:00:00 2001 From: Eliot Whalan Date: Thu, 23 Jun 2016 11:25:12 +1000 Subject: [PATCH] Add static file serving --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 31d28c0..a784b47 100644 --- a/main.go +++ b/main.go @@ -213,13 +213,13 @@ func pasteHandler(w http.ResponseWriter, r *http.Request) { } func main() { - router := mux.NewRouter().StrictSlash(true) - router.PathPrefix("/").Handler(http.StripPrefix("/", http.FileServer(http.Dir("static/")))) + router := mux.NewRouter() router.HandleFunc("/p/{pasteId}", pasteHandler) router.HandleFunc("/p/{pasteId}/{lang}", langHandler) router.HandleFunc("/save", saveHandler) router.HandleFunc("/save/{output}", saveHandler) router.HandleFunc("/del/{pasteId}/{delKey}", delHandler) + router.PathPrefix("/").Handler(http.StripPrefix("/", http.FileServer(http.Dir("static/")))) err := http.ListenAndServe(PORT, router) if err != nil { log.Fatal(err)