From 705fc2f44be5528b07897cd2f020f429024cddf0 Mon Sep 17 00:00:00 2001 From: Mitchell Riedstra Date: Wed, 11 Aug 2021 20:24:54 -0400 Subject: Mess around with go-swagger annotations. Remove some commented out code. --- cmd/web/routes.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'cmd/web/routes.go') 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) }) -- cgit v1.2.3