package router import ( "net/http" "github.com/gorilla/mux" braillexr "github.com/spatialfree/dofdev/web/pages/braille_xr" "github.com/spatialfree/dofdev/web/pages/mono" "github.com/spatialfree/dofdev/tem" ) func New() *mux.Router { r := mux.NewRouter() // .StrictSlash(false) r.PathPrefix(("/public/")).Handler(http.StripPrefix("/public/", http.FileServer(http.Dir("web/public/")))) r.HandleFunc("/", mono.Handler) r.HandleFunc("/braille_xr", braillexr.Handler) r.HandleFunc("/reload", func(w http.ResponseWriter, r *http.Request) { tem.Load() // route them back to where they came from http.Redirect(w, r, r.Header.Get("Referer"), http.StatusFound) }) return r }