All Projects → graphql-dotnet → Conventions

graphql-dotnet / Conventions

Licence: mit
GraphQL Conventions Library for .NET

Projects that are alternatives of or similar to Conventions

Type Graphql
Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
Stars: ✭ 6,864 (+3366.67%)
Mutual labels:  api, graphql, schema
Countries
🌎 Public GraphQL API for information about countries
Stars: ✭ 156 (-21.21%)
Mutual labels:  api, graphql, schema
Graphql Dotnetcore
GraphQL for .NET core based on https://github.com/graphql/graphql-js
Stars: ✭ 97 (-51.01%)
Mutual labels:  api, graphql, dotnetcore
Typegql
Create GraphQL schema with TypeScript classes.
Stars: ✭ 415 (+109.6%)
Mutual labels:  api, graphql, schema
Postgraphile
GraphQL is a new way of communicating with your server. It eliminates the problems of over- and under-fetching, incorporates strong data types, has built-in introspection, documentation and deprecation capabilities, and is implemented in many programming languages. This all leads to gloriously low-latency user experiences, better developer experiences, and much increased productivity. Because of all this, GraphQL is typically used as a replacement for (or companion to) RESTful API services.
Stars: ✭ 10,967 (+5438.89%)
Mutual labels:  api, graphql, schema
Flama
🔥 Fire up your API with this flamethrower
Stars: ✭ 161 (-18.69%)
Mutual labels:  api, schema
Wp Graphql Gutenberg
Query gutenberg blocks with wp-graphql
Stars: ✭ 158 (-20.2%)
Mutual labels:  api, graphql
Examples
Examples of Mock Service Worker usage with various frameworks and libraries.
Stars: ✭ 163 (-17.68%)
Mutual labels:  api, graphql
Graphql Toolkit
A set of utils for faster development of GraphQL tools
Stars: ✭ 169 (-14.65%)
Mutual labels:  graphql, schema
Sangria
Scala GraphQL implementation
Stars: ✭ 1,869 (+843.94%)
Mutual labels:  api, graphql
Express Graphql Typescript Boilerplate
A starter kit for building amazing GraphQL API's with TypeScript and express by @w3tecch
Stars: ✭ 163 (-17.68%)
Mutual labels:  api, graphql
Graphene Django Subscriptions
This package adds support to Subscription's requests and its integration with websockets using Channels package.
Stars: ✭ 173 (-12.63%)
Mutual labels:  api, graphql
Pop
Monorepo of the PoP project, including: a server-side component model in PHP, a GraphQL server, a GraphQL API plugin for WordPress, and a website builder
Stars: ✭ 160 (-19.19%)
Mutual labels:  api, graphql
Vendure
A headless GraphQL ecommerce framework for the modern web
Stars: ✭ 2,961 (+1395.45%)
Mutual labels:  api, graphql
Payload
Headless CMS and Application Framework built with Node.js, React and MongoDB
Stars: ✭ 154 (-22.22%)
Mutual labels:  api, graphql
Netcore Boilerplate
Boilerplate of API in .NET Core 3.1
Stars: ✭ 166 (-16.16%)
Mutual labels:  api, dotnetcore
Graphql2rest
GraphQL to REST converter: automatically generate a RESTful API from your existing GraphQL API
Stars: ✭ 181 (-8.59%)
Mutual labels:  api, graphql
Examples
Examples for GraphQL.NET
Stars: ✭ 179 (-9.6%)
Mutual labels:  api, graphql
Graphql Faker
🎲 Mock or extend your GraphQL API with faked data. No coding required.
Stars: ✭ 2,361 (+1092.42%)
Mutual labels:  api, graphql
Blog Service
blog service @nestjs
Stars: ✭ 188 (-5.05%)
Mutual labels:  api, graphql

GraphQL Conventions Library for .NET

Introduction

GraphQL .NET has been around for a while. This library is a complementary layer on top that allows you to automatically wrap your .NET classes into GraphQL schema definitions using existing property getters and methods as field resolvers.

In short, this project builds on top of the following components:

Disclaimer: I am providing code in this repository to you under an open source licence (MIT). Because this is my personal repository, the licence you receive to my code is from me and not my employer (Facebook).

Installation

Download and install the package from NuGet:

PS> Install-Package GraphQL.Conventions

The following targets are available:

  • .NET Framework 4.5
  • .NET Platform Standard 1.5

Getting Started

Implement your query type:

[ImplementViewer(OperationType.Query)]
public class Query
{
    [Description("Retrieve book by its globally unique ID.")]
    public Task<Book> Book(UserContext context, Id id) =>
        context.Get<Book>(id);

    [Description("Retrieve author by his/her globally unique ID.")]
    public Task<Author> Author(UserContext context, Id id) =>
        context.Get<Author>(id);

    [Description("Search for books and authors.")]
    public Connection<SearchResult> Search(
        UserContext context,
        [Description("Title or last name.")] NonNull<string> forString,
        [Description("Only return search results after given cursor.")] Cursor? after,
        [Description("Return the first N results.")] int? first)
    {
        return context
            .Search(forString.Value)
            .Select(node => new SearchResult { Instance = node })
            .ToConnection(first ?? 5, after);
    }
}

Construct your schema and run your query:

using GraphQL.Conventions;

var engine = GraphQLEngine.New<Query>();
var result = await engine
    .NewExecutor()
    .WithUserContext(userContext)
    .WithDependencyInjector(dependencyInjector)
    .WithRequest(requestBody)
    .Execute();

Examples

More detailed examples can be found in the unit tests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].