We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
gorilla/mux
1 parent b5adb77 commit a960705Copy full SHA for a960705
1 file changed
codegen/codegentemplates/uiroutes.go
@@ -1,14 +1,16 @@
1
package codegentemplates
2
3
-const BackendUiRoutes = `package {{.Module.Id}}
+const BackendUiRoutes = `// frontend HTTP URL routes
4
+package {{.Module.Id}}
5
6
import (
- "github.com/gorilla/mux"
7
"net/http"
8
)
9
10
-func RegisterUiRoutes(routes *mux.Router, uiHandler http.HandlerFunc) { {{range .Module.UiRoutes}}
11
- routes.HandleFunc("{{.Path}}", uiHandler){{end}}
+// even though we have a Single-Page-Application -style frontend we should reserve the frontend routes at backend
+// so when user refreshes the page they'll get the SPA bootstrap page for every possible frontend route.
12
+func RegisterUIRoutes(routes *http.ServeMux, uiHandler http.HandlerFunc) { {{range .Module.UiRoutes}}
13
+ routes.HandleFunc("GET {{.Path}}", uiHandler){{end}}
14
}
15
`
16
0 commit comments