diff options
| author | Mitchell Riedstra <mitch@riedstra.dev> | 2021-08-11 20:24:54 -0400 |
|---|---|---|
| committer | Mitchell Riedstra <mitch@riedstra.dev> | 2021-08-11 20:24:54 -0400 |
| commit | 705fc2f44be5528b07897cd2f020f429024cddf0 (patch) | |
| tree | b4c761104ca78b7fa2df573411808491a3f72eb2 /cmd/web/routes.go | |
| parent | 9d5d130038ed90564c3acfb2fd2ff64e3d7b0bd9 (diff) | |
| download | steam-export-705fc2f44be5528b07897cd2f020f429024cddf0.tar.gz steam-export-705fc2f44be5528b07897cd2f020f429024cddf0.tar.xz | |
Mess around with go-swagger annotations. Remove some commented out code.
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) }) |
