I am a contributor of Hot Chocolate.
In order to get GraphQL running side by side with Web API just add the following package to your project:
HotChocolate.AspNetCore
Then in the ConfigureService method of your startup add the following:
public void ConfigureServices(IServiceCollection services) { services.AddGraphQL(Schema.Create(c => { c.RegisterQueryType<Query>(); })); }
In the configure section just add UseGraphQL
public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseGraphQL(); }
GraphQL is then just another middleware that is side by side to your web api middleware.
If you are using .Net Framework instead of .Net Core then you have to use
HotChocolate.AspNetClassic
We have a StarWars example for .Net Core and .Net Framework here: https://github.com/ChilliCream/hotchocolate/tree/master/examples
And you can find the documentation here: https://hotchocolate.io
Hope that helps.