Skip to content

Commit

Permalink
Try explicitly adding base URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
jmshrv committed Mar 20, 2024
1 parent 42eea2a commit f828b52
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions admin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ func main() {
}

r := mux.NewRouter()
r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
r.PathPrefix("/results").HandlerFunc(handleResults)
r.Path("/").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r.PathPrefix("/admin/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
r.PathPrefix("/admin/results").HandlerFunc(handleResults)
r.Path("/admin").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "./static/index.html")
})

Expand Down
12 changes: 6 additions & 6 deletions ballot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ func main() {
}

r := mux.NewRouter()
r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
r.Path("/candidates/").HandlerFunc(handleCandidates)
r.Path("/active/{id}/").HandlerFunc(handleActive)
r.Path("/submit/").Methods("POST").HandlerFunc(handleSubmit)
r.Path("/").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r.PathPrefix("/ballot/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
r.Path("/ballot/candidates/").HandlerFunc(handleCandidates)
r.Path("/ballot/active/{id}/").HandlerFunc(handleActive)
r.Path("/ballot/submit/").Methods("POST").HandlerFunc(handleSubmit)
r.Path("/ballot").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "./static/index.html")
})
r.Path("/thank-you").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r.Path("/ballot/thank-you").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "./static/thankyou.html")
})

Expand Down
6 changes: 3 additions & 3 deletions registration/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ func main() {
}

r := mux.NewRouter()
r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
r.Path("/register/").Methods("POST").HandlerFunc(registerHandler)
r.Path("/").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
r.PathPrefix("/register/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static/"))))
r.Path("/register/register/").Methods("POST").HandlerFunc(registerHandler)
r.Path("/register").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "./static/index.html")
})

Expand Down

0 comments on commit f828b52

Please sign in to comment.