25 lines
422 B
Go
25 lines
422 B
Go
|
package web
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
|
||
|
"git.kapelle.org/niklas/beerpong-elo/internal/repo"
|
||
|
"github.com/graphql-go/handler"
|
||
|
)
|
||
|
|
||
|
func CreateWebserver(repo repo.Repo) *http.ServeMux {
|
||
|
router := http.NewServeMux()
|
||
|
schema := createShema(repo)
|
||
|
|
||
|
gqlHandler := handler.New(&handler.Config{
|
||
|
Schema: &schema,
|
||
|
Pretty: true,
|
||
|
GraphiQL: true,
|
||
|
})
|
||
|
|
||
|
router.Handle("/graphql", gqlHandler)
|
||
|
initStatic(router)
|
||
|
|
||
|
return router
|
||
|
}
|