Skip to content

alexsteinerde/graphiql-vapor

Repository files navigation

GraphiQLVapor

Language Vapor Version build

This package ships functionality to add the GraphiQL GraphQL web editor and request-tester page to an RoutesBuilder instance in Vapor.

Installation

import PackageDescription

let package = Package(
    dependencies: [
        .package(url: "https://github.com/alexsteinerde/graphiql-vapor.git", from: "2.2.0"),
    ],
    targets: [
        .target(
            name: "App",
            dependencies: [
                .product(name: "GraphiQLVapor", package: "graphiql-vapor"),
            ]
        ),
    ...
    ]
)

Example

app.enableGraphiQL()

This will register the web page on GET /. If you want to have GraphiQL available on another route, call app.enableGraphiQL(on: "/graphiQL) or app.grouped("graphiQL").enableGraphiQL() instead.

License

This project is available under the MIT license. See the LICENSE file for more info.

Contribution

You can contribute to this project by submitting a detailed issue or by forking this project and sending a pull request. Contributions of any kind are very welcome :)