diff --git a/Sources/GraphiQLVapor/GraphiQLVapor.swift b/Sources/GraphiQLVapor/GraphiQLVapor.swift index c593294..93bbf26 100644 --- a/Sources/GraphiQLVapor/GraphiQLVapor.swift +++ b/Sources/GraphiQLVapor/GraphiQLVapor.swift @@ -7,17 +7,21 @@ extension Request { } public extension Application { - func enableGraphiQL(on pathComponents: PathComponent..., method: HTTPMethod = .GET) { + func enableGraphiQL(on pathComponents: PathComponent..., method: HTTPMethod = .GET, serverPath: PathComponent = "/graphql") { + graphQLServerPath = serverPath + self.on(method, pathComponents) { (request) -> Response in request.serve(html: grahphiQLHTML) } } func enableGraphiQL(method: HTTPMethod = .GET) { - self.enableGraphiQL(on: "", method: .GET) + self.enableGraphiQL(on: "", method: .GET, serverPath: "/graphql") } } +var graphQLServerPath: PathComponent = "/graphql" + let grahphiQLHTML = """