在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):graphql-perl/graphql-perl开源软件地址(OpenSource Url):https://github.com/graphql-perl/graphql-perl开源编程语言(OpenSource Language):Perl 99.5%开源软件介绍(OpenSource Introduction):NAMEGraphQL - Perl implementation of GraphQL PROJECT STATUS
SYNOPSIS
The above is from the sample Dancer 2 applet. DESCRIPTIONThis module is a port of the GraphQL reference implementation, graphql-js, to Perl 5. It now supports Promises, allowing asynchronous operation. See Mojolicious::Plugin::GraphQL for an example of how to take advantage of this. As of 0.39, supports GraphQL subscriptions. See GraphQL::Type for description of how to create GraphQL types. Introduction to GraphQLGraphQL is a technology that lets clients talk to APIs via a single endpoint, which acts as a single "source of the truth". This means clients do not need to seek the whole picture from several APIs. Additionally, it makes this efficient in network traffic, time, and programming effort:
Basic conceptsGraphQL implements a system featuring a schema, which features various classes of types, some of which are objects. Special objects provide the roots of queries (mandatory), and mutations and subscriptions (both optional). Objects have fields, each of which can be specified to take arguments, and which have a return type. These are effectively the properties and/or methods on the type. If they return an object, then a query can specify subfields of that object, and so on - as alluded to in the "time-saving" point above. For more, see the JavaScript tutorial in "SEE ALSO". Hooking your system up to GraphQLYou will need to decide how to model your system in GraphQL terms. This will involve deciding on what output object types you have, what fields they have, and what arguments and return-types those fields have. Additionally, you will need to design mutations if you want to be able to update/create/delete data. This requires some thought for return types, to ensure you can get all the information you need to proceed to avoid extra round-trips. The easiest way to achieve these things is to make a GraphQL::Plugin::Convert subclass, to encapsulate the specifics of your system. See the documentation for further information. Finally, you should consider whether you need "subscriptions". These are designed to hook into WebSockets. Apollo has a JavaScript module for this. Specifying types and fields is straightforward. See the document for how to make resolvers. DEBUGGINGTo debug, set environment variable EXPORTNone yet. SEE ALSOSQL::Translator::Producer::GraphQL - produce GraphQL schemas from a DBIx::Class::Schema (or in fact any SQL database) GraphQL::Plugin::Convert::DBIC - produce working GraphQL schema from a DBIx::Class::Schema GraphQL::Plugin::Convert::OpenAPI - produce working GraphQL schema from an OpenAPI specification Sample Mojolicious OpenAPI to GraphQL applet http://facebook.github.io/graphql/ - GraphQL specification http://graphql.org/graphql-js/ - Tutorial on the JavaScript version, highly recommended. Translation to graphql-perl. AUTHOREd J, BUGSPlease report any bugs or feature requests on https://github.com/graphql-perl/graphql-perl/issues. Or, if you prefer email and/or RT: to ACKNOWLEDGEMENTSThe creation of this work has been sponsored by Perl Careers: https://perl.careers/. Artur Khabibullin The creation of the subscriptions functionality in this work has been sponsored by Sanctus.app: https://sanctus.app. LICENSE AND COPYRIGHTCopyright 2017 Ed J. This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: http://www.perlfoundation.org/artistic_license_2_0 |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论