aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/99designs/gqlgen/plugin/servergen/server.gotpl
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-04-09 21:45:24 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-04-09 21:45:24 +0200
commit26b5343e2160de172969e6834074cf8482ceb845 (patch)
tree04f27aa660a903d65f7b3d951bd1c6f92c59c0c3 /vendor/github.com/99designs/gqlgen/plugin/servergen/server.gotpl
parent6e8496f4c1767ca8a8b95716a04f1b492bef7397 (diff)
downloadgit-bug-26b5343e2160de172969e6834074cf8482ceb845.tar.gz
Update Gopkg.*
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/plugin/servergen/server.gotpl')
-rw-r--r--vendor/github.com/99designs/gqlgen/plugin/servergen/server.gotpl20
1 files changed, 20 insertions, 0 deletions
diff --git a/vendor/github.com/99designs/gqlgen/plugin/servergen/server.gotpl b/vendor/github.com/99designs/gqlgen/plugin/servergen/server.gotpl
new file mode 100644
index 00000000..fca71c53
--- /dev/null
+++ b/vendor/github.com/99designs/gqlgen/plugin/servergen/server.gotpl
@@ -0,0 +1,20 @@
+{{ reserveImport "context" }}
+{{ reserveImport "log" }}
+{{ reserveImport "net/http" }}
+{{ reserveImport "os" }}
+{{ reserveImport "github.com/99designs/gqlgen/handler" }}
+
+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({{ lookupImport .ExecPackageName }}.NewExecutableSchema({{ lookupImport .ExecPackageName}}.Config{Resolvers: &{{ lookupImport .ResolverPackageName}}.Resolver{}})))
+
+ log.Printf("connect to http://localhost:%s/ for GraphQL playground", port)
+ log.Fatal(http.ListenAndServe(":" + port, nil))
+}