Skip to content

Commit

Permalink
Merge pull request #131 from movio/remove-query-cache-from-gateway
Browse files Browse the repository at this point in the history
Remove query caching from exposed gateway
  • Loading branch information
pkqk authored Mar 13, 2022
2 parents 9508331 + fb33c45 commit 70a8e42
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"time"

"github.com/99designs/gqlgen/graphql/handler"
"github.com/99designs/gqlgen/graphql/handler/extension"
"github.com/99designs/gqlgen/graphql/handler/transport"
log "github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -37,9 +39,18 @@ func (g *Gateway) UpdateSchemas(interval time.Duration) {
func (g *Gateway) Router() http.Handler {
mux := http.NewServeMux()

// Duplicated from `handler.NewDefaultServer` minus
// the websocket transport and persisted query extension
gatewayHandler := handler.New(g.ExecutableSchema)
gatewayHandler.AddTransport(transport.Options{})
gatewayHandler.AddTransport(transport.GET{})
gatewayHandler.AddTransport(transport.POST{})
gatewayHandler.AddTransport(transport.MultipartForm{})
gatewayHandler.Use(extension.Introspection{})

mux.Handle("/query",
applyMiddleware(
handler.NewDefaultServer(g.ExecutableSchema),
gatewayHandler,
debugMiddleware,
),
)
Expand Down

0 comments on commit 70a8e42

Please sign in to comment.