All Projects → JosephWoodward → Graphiql Dotnet

JosephWoodward / Graphiql Dotnet

Licence: mit
GraphiQL middleware for ASP.NET Core

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Graphiql Dotnet

Dapper.graphql
A .NET Core library designed to integrate the Dapper and graphql-dotnet projects with ease-of-use in mind and performance as the primary concern.
Stars: ✭ 244 (+76.81%)
Mutual labels:  graphql, dotnet-core
Templates
.NET project templates with batteries included, providing the minimum amount of code required to get you going faster.
Stars: ✭ 2,864 (+1975.36%)
Mutual labels:  graphql, dotnet-core
Practical Dapr
A full-stack .NET microservices build on Dapr and Tye
Stars: ✭ 140 (+1.45%)
Mutual labels:  graphql, dotnet-core
Eschool
eSchool Microservice based Solution
Stars: ✭ 29 (-78.99%)
Mutual labels:  graphql, dotnet-core
Graphql Dotnet
GraphQL for .NET
Stars: ✭ 5,031 (+3545.65%)
Mutual labels:  graphql, dotnet-core
Dotnet Fake Json Server
Fake JSON Server is a Fake REST API that can be used as a Back End for prototyping or as a template for a CRUD Back End.
Stars: ✭ 265 (+92.03%)
Mutual labels:  graphql, dotnet-core
Hotchocolate
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
Stars: ✭ 3,009 (+2080.43%)
Mutual labels:  graphql, dotnet-core
Framework
.NET Core Extensions and Helper NuGet packages.
Stars: ✭ 399 (+189.13%)
Mutual labels:  graphql, dotnet-core
Starwars
GraphQL 'Star Wars' example using GraphQL for .NET, ASP.NET Core, Entity Framework Core
Stars: ✭ 559 (+305.07%)
Mutual labels:  graphql, dotnet-core
Asp.net Core Graphql Middleware
ASP.Net Core GraphQL Middleware
Stars: ✭ 38 (-72.46%)
Mutual labels:  graphql, dotnet-core
Graphql Compose Examples
Live examples of schemas builded with graphql-compose
Stars: ✭ 134 (-2.9%)
Mutual labels:  graphql
Gatsby Starter Foundation
A starter to launch your blazing fast personal website and a blog, Built with Gatsby and Netlify CMS. Made with ❤ by Stackrole
Stars: ✭ 135 (-2.17%)
Mutual labels:  graphql
Schema Stitching Handbook
Guided examples exploring GraphQL Tools v6+ Schema Stitching
Stars: ✭ 137 (-0.72%)
Mutual labels:  graphql
Basic Shopify Api
A simple API wrapper for Shopify using Guzzle for REST and GraphQL
Stars: ✭ 137 (-0.72%)
Mutual labels:  graphql
Graphql Mqtt Subscriptions
graphql-subscriptions implementation for MQTT protocol
Stars: ✭ 133 (-3.62%)
Mutual labels:  graphql
Framework
Strongly-typed JavaScript object with support for validation and error handling.
Stars: ✭ 136 (-1.45%)
Mutual labels:  graphql
Aws Mobile Appsync Events Starter React Native
GraphQL starter application with Realtime and Offline functionality using AWS AppSync
Stars: ✭ 134 (-2.9%)
Mutual labels:  graphql
Webspace
This is the repo which hosts the front end for people.amfoss.in
Stars: ✭ 134 (-2.9%)
Mutual labels:  graphql
Python Graphql Client
Simple GraphQL client for Python 2.7+
Stars: ✭ 133 (-3.62%)
Mutual labels:  graphql
Coolstore Microservices
A full-stack .NET microservices build on Dapr and Tye
Stars: ✭ 1,903 (+1278.99%)
Mutual labels:  dotnet-core

GraphiQL.NET

.NET Core

GraphiQL middleware for ASP.NET Core - try the live demo here.

What is GraphiQL.NET?

GraphiQL.NET is a piece of .NET Core middleware that bundles graphiql into it saving you from managing additional frontend dependencies, whilst also giving you control over the routes it's avaialble on any provide you with a means of authentication.

GraphiQL.NET features include:

  • The full GraphiQl experience
  • Customisation of GraphiQL routes
  • Authentication

GraphiQL for ASP.NET Core

Setup

The GraphiQL.NET middleware can be found on NuGet here

You can install GraphiQL.NET by copying and pasting the following command into your Package Manager Console within Visual Studio (Tools > NuGet Package Manager > Package Manager Console).

Install-Package graphiql

Alternatively you can install it using the .NET Core CLI using the following command:

dotnet add package graphiql

Getting Started

Once installed you can add GraphiQL.NET to your ASP.NET Core application by adding the app.UseGraphiQl() middleware to the Configure method within your Startup.cs file.

Note: Be sure to call UseGraphiQl() before UseMvc().

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    // Adding this makes graphiql UI available at /graphql 
    app.UseGraphiQl();

    app.UseMvc();
}

Configuration


Configure Graphiql route

By default GraphiQL lives on the /graphql endpoint, however this can be changed by passing your chosen path to the app.UseGraphiQl(); entry point method:

app.UseGraphiQl('/whatever/graphiql');

Configure Graphql API address

You can also specify GraphiQl endpoint independent of your GraphQL API, this is especially useful if you're hosting in IIS in a virtual application (ie myapp.com/1.0/...) or hosting API and documentation separately.

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
    app.UseGraphiQl("/graphql", "/v1/yourapi");

    app.UseMvc();
}

Now navigating to /graphql will display the GraphiQL UI, but your GraphQL API will live under the /v1/yourapi route.

Configuration via IServiceCollection

Alternatively you can configure the aforementioned routes via IServiceCollection within ConfigureServices or your Startup.cs file:

//Startup.cs

public void ConfigureServices(IServiceCollection services)
{
    ...

	services.AddGraphiQl(x =>
	{
		x.GraphiQlPath = "/graphiql-ui";
		x.GraphQlApiPath = "graphql";
	});

    ...
}

public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
	app.UseGraphiQl();
	...
}

Configuration via ConfigureOptions<T>

You can also use the IConfigureOptions<T> interface:

// GraphiQlTestOptionsSetup.cs

internal class GraphiQlTestOptionsSetup : IConfigureOptions<GraphiQlOptions>
{
    public void Configure(GraphiQlOptions options)
    {
        options.GraphiQlPath = "/graphiql-ui";
        options.GraphQlApiPath = "graphql";
    }
}

Then you just have to register it with your Ioc Container:

//Startup.cs

public void ConfigureServices(IServiceCollection services)
{
    ...
    services.AddTransient<IConfigureOptions<GraphiQlOptions>, GraphiQlTestOptionsSetup>();z
    ...
}
---
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].