Issue with GraphQL Kestrel API server C# ASP.NET Core 7

75 Views Asked by At

Here's the issue: I have an ASP.NET Core 7 Web API listening on https://localhost:5248/sap/opu/odata/GIBSFI/ALERT_SRV, but when a request comes in, it needs to run the request to on https://localhost:5248/sap/opu/odata/GIBSFI/ALERT_SRV/graphql and return the results.

Keep in mind this is a piece of middleware and I can not alter the URL the other app is submitting to. Pretty straight forward Program.cs set up:

var builder = WebApplication.CreateBuilder(args);
builder.Services
    .AddSingleton<Repository>()
    .AddGraphQLServer()
    .AddQueryType<Query>()
    .AddMutationType<Mutation>();
``
var app = builder.Build();
app.UseExceptionHandler("/error");
app.UsePathBase("/sap/opu/odata/GIBSFI/ALERT_SRV");
app.MapGraphQL().AllowAnonymous();

app.Run();

I tried using app.MapGet and app.MapPost but unsure how to create the handlers

0

There are 0 best solutions below