github.com/fortexxx/gqlgen@v0.10.3-0.20191216030626-ca5ea8b21ead/example/config/server/server.go (about)

     1  package main
     2  
     3  import (
     4  	"log"
     5  	"net/http"
     6  
     7  	todo "github.com/99designs/gqlgen/example/config"
     8  	"github.com/99designs/gqlgen/graphql/handler"
     9  	"github.com/99designs/gqlgen/graphql/playground"
    10  )
    11  
    12  func main() {
    13  	http.Handle("/", playground.Handler("Todo", "/query"))
    14  	http.Handle("/query", handler.NewDefaultServer(
    15  		todo.NewExecutableSchema(todo.New()),
    16  	))
    17  	log.Fatal(http.ListenAndServe(":8081", nil))
    18  }