route pages
This commit is contained in:
parent
c40f003590
commit
4a5f23da84
1 changed files with 23 additions and 8 deletions
|
@ -3,10 +3,15 @@ package router
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
"dofdev/web/pages/about"
|
||||
braillexr "dofdev/web/pages/braille_xr"
|
||||
"dofdev/web/pages/games"
|
||||
"dofdev/web/pages/mono"
|
||||
"dofdev/web/pages/moves"
|
||||
"dofdev/web/pages/projects"
|
||||
"dofdev/web/pages/sc"
|
||||
|
||||
"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 {
|
||||
|
@ -14,12 +19,22 @@ func New() *mux.Router {
|
|||
|
||||
r.PathPrefix(("/public/")).Handler(http.StripPrefix("/public/", http.FileServer(http.Dir("web/public/"))))
|
||||
r.HandleFunc("/", mono.Handler)
|
||||
r.HandleFunc("/about", about.Handler)
|
||||
r.HandleFunc("/moves", moves.Handler)
|
||||
r.HandleFunc("/move/{hash}", moves.MoveHandler)
|
||||
r.HandleFunc("/games", games.Handler)
|
||||
r.HandleFunc("/game/{hash}", games.GameHandler)
|
||||
r.HandleFunc("/projects", projects.Handler)
|
||||
r.HandleFunc("/project/{hash}", projects.ProjectHandler)
|
||||
|
||||
r.HandleFunc("/sc", sc.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)
|
||||
})
|
||||
// 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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue