graphql-perl - Mojolicious::Plugin::GraphQL - Mojolicious GraphQL endpoint

Having made a Dancer 2 plugin to easily make GraphQL endpoints, it only seemed fair to make a Mojolicious plugin to do the same thing. That has just been released to CPAN. There is also a sample applet for Mojolicious::Lite.

Sample code from the applet:

my $schema = GraphQL::Schema->new(
    query => GraphQL::Type::Object->new(
        name => 'QueryRoot',
        fields => {
            helloWorld => {
                type => $String,
                resolve => sub { 'Hello, world!' },
            },
        },
    ),
);
plugin GraphQL => {schema => $schema, graphiql => 1};

The next step will be to make GraphQL correctly handle asynchronous resolvers, using the excellent Future module.

The porting of GraphQL to Perl 5 is sponsored by Perl Careers.

Leave a comment

About Mohawk

user-pic I blog about Perl.