aboutsummaryrefslogtreecommitdiffstats
path: root/commands/webui.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/webui.go')
-rw-r--r--commands/webui.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/commands/webui.go b/commands/webui.go
index 802fc5df..80bda980 100644
--- a/commands/webui.go
+++ b/commands/webui.go
@@ -2,12 +2,13 @@ package commands
import (
"fmt"
- "github.com/MichaelMure/git-bug/graphql"
+ "github.com/MichaelMure/git-bug/graphql2"
"github.com/MichaelMure/git-bug/webui"
"github.com/gorilla/mux"
"github.com/phayes/freeport"
"github.com/skratchdot/open-golang/open"
"github.com/spf13/cobra"
+ "github.com/vektah/gqlgen/handler"
"log"
"net/http"
)
@@ -28,16 +29,11 @@ func runWebUI(cmd *cobra.Command, args []string) error {
fmt.Printf("Web UI available at %s\n", webUiAddr)
- graphqlHandler, err := graphql.NewHandler(repo)
-
- if err != nil {
- return err
- }
-
router := mux.NewRouter()
// Routes
- router.Path("/graphql").Handler(graphqlHandler)
+ router.Path("/playground").Handler(handler.Playground("git-bug", "/graphql"))
+ router.Path("/graphql").Handler(graphql2.NewHandler(repo))
router.PathPrefix("/").Handler(http.FileServer(webui.WebUIAssets))
open.Run(webUiAddr)