Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop pickup "github.com/vektah/gqlgen/handler" from GOPATH #270

Merged
merged 2 commits into from
Aug 9, 2018

Conversation

vvakame
Copy link
Collaborator

@vvakame vvakame commented Aug 7, 2018

$ gqlgen init
Exec "go run ./server/server.go" to start GraphQL server

$ cat server/server.go
package main

import (
	"log"
	"net/http"
	"os"

	"github.com/vektah/gqlgen/handler"
	gqlgen_implements "github.com/vvakame/til/graphql/gqlgen-implements"
)

const defaultPort = "8080"

func main() {
	port := os.Getenv("PORT")
	if port == "" {
		port = defaultPort
	}

	http.Handle("/", handler.Playground("GraphQL playground", "/query"))
	http.Handle("/query", handler.GraphQL(gqlgen_implements.NewExecutableSchema(gqlgen_implements.Config{Resolvers: &gqlgen_implements.Resolver{}})))

	log.Printf("connect to http://localhost:%s/ for GraphQL playground", port)
	log.Fatal(http.ListenAndServe(":"+port, nil))
}

@vvakame vvakame requested a review from vektah August 7, 2018 08:31
@vektah
Copy link
Collaborator

vektah commented Aug 8, 2018

This should be added to the relevant build step, that list is shared by all the steps and handler should only be referenced by the generated resolvers.

So add it in here https://github.com/99designs/gqlgen/blob/master/codegen/build.go#L88

@vvakame
Copy link
Collaborator Author

vvakame commented Aug 9, 2018

I pushed a commit. is this chages right?

@vektah vektah merged commit 53109cd into master Aug 9, 2018
@vvakame vvakame deleted the feat-handlers branch August 9, 2018 11:55
cgxxv pushed a commit to cgxxv/gqlgen that referenced this pull request Mar 25, 2022
stop pickup "github.com/vektah/gqlgen/handler" from GOPATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants