diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/hub/src/spreadspace.org/sfive/s5srvForward.go | 4 | ||||
-rw-r--r-- | src/hub/src/spreadspace.org/sfive/s5srvWeb.go | 16 | ||||
-rwxr-xr-x | src/hub/test-client | 6 |
3 files changed, 14 insertions, 12 deletions
diff --git a/src/hub/src/spreadspace.org/sfive/s5srvForward.go b/src/hub/src/spreadspace.org/sfive/s5srvForward.go index 904dc18..9e395be 100644 --- a/src/hub/src/spreadspace.org/sfive/s5srvForward.go +++ b/src/hub/src/spreadspace.org/sfive/s5srvForward.go @@ -54,7 +54,7 @@ func fwdGetLastUpdateID(baseUrl string, client *http.Client, hubUUID string) (la lastID = -1 var resp *http.Response - resp, err = client.Get(baseUrl + "/lastupdate/" + hubUUID) + resp, err = client.Get(baseUrl + "/api/v1/lastupdate/" + hubUUID) if err != nil { s5l.Printf("srv|fwd: querying for lastupdate failed: %v", err) return @@ -110,7 +110,7 @@ func fwdPostUpdates(client *http.Client, url string, pr *io.PipeReader) (int, er } func (srv *Server) forwardRun(baseUrl string, client *http.Client) { - url := baseUrl + "/updates/_bulk" + url := baseUrl + "/api/v1/updates/_bulk" hubUUID := srv.store.GetHubUUID() tryResync: for { diff --git a/src/hub/src/spreadspace.org/sfive/s5srvWeb.go b/src/hub/src/spreadspace.org/sfive/s5srvWeb.go index 65e677a..54f1d18 100644 --- a/src/hub/src/spreadspace.org/sfive/s5srvWeb.go +++ b/src/hub/src/spreadspace.org/sfive/s5srvWeb.go @@ -419,14 +419,16 @@ func (srv *Server) ServeWeb(cfg WebInterfaceConfig) error { s5l.Printf("srv|web: listening on '%s'", cfg.ListenAddr) mux := http.NewServeMux() + + mux.Handle("/api/v1/hubs", http.StripPrefix("/api/v1", webHandler{srv, webHubs})) + mux.Handle("/api/v1/sources", http.StripPrefix("/api/v1", webHandler{srv, webSources})) + mux.Handle("/api/v1/clients", http.StripPrefix("/api/v1", webHandler{srv, webClients})) + mux.Handle("/api/v1/updates/", http.StripPrefix("/api/v1", webHandler{srv, webUpdatesWithParam})) + mux.Handle("/api/v1/updates", http.StripPrefix("/api/v1", webHandler{srv, webUpdates})) + mux.Handle("/api/v1/lastupdate/", http.StripPrefix("/api/v1", webHandler{srv, webLastUpdateIDForUUID})) + mux.Handle("/api/v1/lastupdate", http.StripPrefix("/api/v1", webHandler{srv, webLastUpdateID})) + mux.Handle("/healthz", webHandler{srv, webHealthz}) - mux.Handle("/hubs", webHandler{srv, webHubs}) - mux.Handle("/sources", webHandler{srv, webSources}) - mux.Handle("/clients", webHandler{srv, webClients}) - mux.Handle("/updates/", webHandler{srv, webUpdatesWithParam}) - mux.Handle("/updates", webHandler{srv, webUpdates}) - mux.Handle("/lastupdate/", webHandler{srv, webLastUpdateIDForUUID}) - mux.Handle("/lastupdate", webHandler{srv, webLastUpdateID}) // mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir( ..staticDir.. )))) mux.Handle("/", webHandler{srv, webNotFound}) diff --git a/src/hub/test-client b/src/hub/test-client index 620d9a4..0e3424e 100755 --- a/src/hub/test-client +++ b/src/hub/test-client @@ -18,18 +18,18 @@ case $1 in web) echo "web: post sample-web.json" echo "-------------------------" - time curl 'http://localhost:8000/updates' -d @../../dat/sample-web.json + time curl 'http://localhost:8000/api/v1/updates' -d @../../dat/sample-web.json echo "" ;; web-bulk) echo "web: post sample-web-bulk.json" echo "------------------------------" - time curl 'http://localhost:8000/updates/_bulk' -d @../../dat/sample-web-bulk.json + time curl 'http://localhost:8000/api/v1/updates/_bulk' -d @../../dat/sample-web-bulk.json echo "" ;; esac echo "store contents" echo "--------------" -curl 'http://localhost:8000/updates/_bulk' | jq . +curl 'http://localhost:8000/api/v1/updates/_bulk' | jq . echo "" |