Skip to content

Latest commit

 

History

History

Modulight.Modules.Server.GraphQL

Modulight.Modules.Server.GraphQL

// in Startup: void ConfigureServices(ISeviceCollection services)

services.AddModules(builder => {
    builder.UseGraphQLServerModules().AddModule<FooModule>();
});

// in Startup: void Configure(IApplicationBuilder app, IWebHostEnvironment env)

app.UseEndpoints(endpoints =>
{
    // modules mapper
    endpoints.MapGraphQLServerModuleEndpoints(postMapEndpoint: (module, builder) =>
    {
        builder.RequireCors(cors =>
        {
            cors.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod();
        });
    });
});