Namespace is a query param

This commit is contained in:
Bel LaPointe
2020-07-24 12:42:42 -06:00
parent 0e980b1128
commit 11e7d13cca
5 changed files with 76 additions and 31 deletions

View File

@@ -9,20 +9,17 @@ import (
"local/dndex/storage/entity"
"local/dndex/storage/operator"
"net/http"
"path"
"strings"
"github.com/buger/jsonparser"
"go.mongodb.org/mongo-driver/bson"
)
func who(g storage.Graph, w http.ResponseWriter, r *http.Request) error {
namespace := strings.TrimLeft(r.URL.Path, path.Dir(r.URL.Path))
namespace := r.URL.Query().Get("namespace")
if len(namespace) == 0 {
http.NotFound(w, r)
return nil
}
namespace = strings.Replace(namespace, "/", ".", -1)
switch r.Method {
case http.MethodGet: