I'm using a third-party router (httprouter) on Google App Engine and would like to serve static files from root.
Because of App Engine, I need to attach the third-party router to the DefaultServeMux
on /
:
router := httprouter.New()
// Doesn't work, duplicated "/".
http.Handle("/", http.FileServer(http.Dir("public")))
// Needed because of App Engine.
http.Handle("/", router)
The problem is this duplicates the /
pattern and panics with "multiple registrations for /"
How can I serve files, especially index.html
from root and use a third-party router?