diff options
Diffstat (limited to 'cmd/web/routes.go')
| -rw-r--r-- | cmd/web/routes.go | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/cmd/web/routes.go b/cmd/web/routes.go index 12bb807..52ae5d9 100644 --- a/cmd/web/routes.go +++ b/cmd/web/routes.go @@ -9,7 +9,8 @@ import ( func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request) { rtr := mux.NewRouter() - // rtr.PathPrefix("/api/v1").Handler(a.HandleAPIv1()) + rtr.PathPrefix("/api/v1").Handler( + http.StripPrefix("/api/v1", a.HandleAPIv1())) rtr.Handle("/quit", UnauthorizedIfNotLocal(http.HandlerFunc(HandleQuit))) rtr.Handle("/setLib", UnauthorizedIfNotLocal(http.HandlerFunc(a.HandleSetLib))) @@ -31,9 +32,18 @@ func (a *App) HandleAPIv1() http.Handler { rtr := mux.NewRouter() rtr.Handle("/quit", UnauthorizedIfNotLocal(http.HandlerFunc(HandleQuit))) - rtr.Handle("/library", UnauthorizedIfNotLocal(http.HandlerFunc(a.HandleSetLib))) - rtr.Handle("/library/delete", UnauthorizedIfNotLocal(http.HandlerFunc(a.HandleSetLib))) - rtr.Handle("/library/delete", UnauthorizedIfNotLocal(http.HandlerFunc(a.HandleSetLib))) + rtr.Handle("/share-link", http.HandlerFunc(a.HandleShareLink)) + rtr.Handle("/version", http.HandlerFunc(a.HandleVersion)) + rtr.Path("/lib/games").Methods("GET").HandlerFunc(a.HandleGameList) + rtr.Path("/lib/game/{game}").Methods("GET").HandlerFunc(a.HandleDownload) + rtr.Path("/lib/game/{game}").Methods("Delete").Handler( + UnauthorizedIfNotLocal(http.HandlerFunc(a.HandleDeleteV1))) + rtr.Path("/lib/refresh").Methods("GET", "POST").Handler( + UnauthorizedIfNotLocal(http.HandlerFunc(a.HandleRefresh))) + rtr.Path("/lib/path").Methods("POST").Handler( + UnauthorizedIfNotLocal(http.HandlerFunc(a.HandleSetLibV1))) + rtr.Path("/lib/install").Methods("POST").Handler( + UnauthorizedIfNotLocal(http.HandlerFunc(a.HandleInstallV1))) rtr.ServeHTTP(w, r) }) |
