Subrouter fix
This commit is contained in:
4
main.go
4
main.go
@@ -9,7 +9,9 @@ import (
|
||||
"github.com/gorilla/mux"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -63,7 +65,7 @@ func setupFrontend(r *mux.Router) {
|
||||
landingpage := template.Must(template.ParseFiles(filepath.Join(config.FrontendDir, "html", "landingpage.gohtml")))
|
||||
|
||||
r.PathPrefix("/").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/" {
|
||||
if strings.TrimPrefix(r.URL.Path, path.Dir(config.Prefix)) == "/" {
|
||||
landingpage.Execute(w, config.PageBase)
|
||||
} else {
|
||||
server.Error404(w, r)
|
||||
|
||||
Reference in New Issue
Block a user