@@ -19,15 +19,25 @@ type MuxRouterSignalR struct {
19
19
}
20
20
21
21
func (router * MuxRouterSignalR ) HandleFunc (path string , f func (w http.ResponseWriter , r * http.Request )) {
22
- router .NewRoute ().Path (path ).HandlerFunc (f )
22
+ router .HandleFuncRoute (path , f )
23
+ }
24
+
25
+ func (router * MuxRouterSignalR ) HandleFuncRoute (path string , f func (w http.ResponseWriter , r * http.Request )) * mux.Route {
26
+ route := router .NewRoute ().Path (path ).HandlerFunc (f )
23
27
router .paths = append (router .paths , path )
24
28
log .Printf ("Route %s registered\n " , path )
29
+ return route
25
30
}
26
31
27
32
func (router * MuxRouterSignalR ) Handle (path string , handler http.Handler ) {
28
- router .NewRoute ().Path (path ).Handler (handler )
33
+ router .HandleRoute (path , handler )
34
+ }
35
+
36
+ func (router * MuxRouterSignalR ) HandleRoute (path string , handler http.Handler ) * mux.Route {
37
+ route := router .NewRoute ().Path (path ).Handler (handler )
29
38
router .paths = append (router .paths , path )
30
39
log .Printf ("Route %s registered\n " , path )
40
+ return route
31
41
}
32
42
33
43
func WithMuxRouter (router * MuxRouterSignalR ) func () signalr.MappableRouter {
@@ -36,6 +46,10 @@ func WithMuxRouter(router *MuxRouterSignalR) func() signalr.MappableRouter {
36
46
}
37
47
}
38
48
49
+ func (router * MuxRouterSignalR ) AddStaticFiles () {
50
+ router .PathPrefix ("/app-array/" ).Handler (http .StripPrefix ("/app-array/" , http .FileServer (http .Dir ("./build/" ))))
51
+ }
52
+
39
53
func (router * MuxRouterSignalR ) AddHandledFunctions () {
40
54
router .HandleFunc ("/models/{id}" , func (writer http.ResponseWriter , request * http.Request ) {
41
55
vars := mux .Vars (request )
0 commit comments