github.com/jepp2078/gqlgen@v0.7.2/example/dataloader/server/server.go (about) 1 package main 2 3 import ( 4 "log" 5 "net/http" 6 7 "github.com/99designs/gqlgen/example/dataloader" 8 "github.com/99designs/gqlgen/handler" 9 "github.com/go-chi/chi" 10 ) 11 12 func main() { 13 router := chi.NewRouter() 14 router.Use(dataloader.LoaderMiddleware) 15 16 router.Handle("/", handler.Playground("Dataloader", "/query")) 17 router.Handle("/query", handler.GraphQL( 18 dataloader.NewExecutableSchema(dataloader.Config{Resolvers: &dataloader.Resolver{}}), 19 )) 20 21 log.Println("connect to http://localhost:8082/ for graphql playground") 22 log.Fatal(http.ListenAndServe(":8082", router)) 23 }