-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
30 lines (27 loc) · 1.03 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using CommanderGQL.Data;
using CommanderGQL.GraphQL;
using CommanderGQL.GraphQL.Commands;
using CommanderGQL.GraphQL.Platforms;
using Microsoft.EntityFrameworkCore;
using GraphQL.Server.Ui.Voyager;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddPooledDbContextFactory<AppDbContext>(
opt =>
opt.UseSqlServer(builder.Configuration
.GetConnectionString("CommandConStr")));
builder.Services.AddGraphQLServer()
.AddQueryType<Query>()
.AddType<PlatformType>()
.AddMutationType<Mutation>()
.AddType<CommandType>()
.AddFiltering()
.AddSorting();
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.UseRouting();
app.UseEndpoints(endpoints => endpoints.MapGraphQL());
app.UseGraphQLVoyager(new VoyagerOptions
{
GraphQLEndPoint = "/graphql",
}, "/graphql-voyager");
app.Run();