From cf2450f5f7ba262601766c7f761d138353dedf63 Mon Sep 17 00:00:00 2001 From: David Lebee Date: Sun, 7 Feb 2021 00:12:41 -0500 Subject: [PATCH] added cors and added produces json. --- Demo/Startup.cs | 3 +++ PoweredSoft.CQRS.AspNetCore/Mvc/CommandController.cs | 2 ++ PoweredSoft.CQRS.AspNetCore/Mvc/QueryController.cs | 1 + 3 files changed, 6 insertions(+) diff --git a/Demo/Startup.cs b/Demo/Startup.cs index 4402ac8..b5d83bd 100644 --- a/Demo/Startup.cs +++ b/Demo/Startup.cs @@ -74,6 +74,7 @@ namespace Demo services.AddPoweredSoftGraphQLFluentValidation(); services.AddSwaggerGen(); + services.AddCors(); } private void AddDynamicQueries(IServiceCollection services) @@ -113,6 +114,8 @@ namespace Demo app.UseHttpsRedirection(); + app.UseCors(o => o.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod()); + app.UseRouting(); app.UseAuthorization(); diff --git a/PoweredSoft.CQRS.AspNetCore/Mvc/CommandController.cs b/PoweredSoft.CQRS.AspNetCore/Mvc/CommandController.cs index 7901ca3..2cabc11 100644 --- a/PoweredSoft.CQRS.AspNetCore/Mvc/CommandController.cs +++ b/PoweredSoft.CQRS.AspNetCore/Mvc/CommandController.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; namespace PoweredSoft.CQRS.AspNetCore.Mvc { + [Produces("application/json")] [ApiController, Route("api/command/[controller]")] public class CommandController : Controller where TCommand : class @@ -23,6 +24,7 @@ namespace PoweredSoft.CQRS.AspNetCore.Mvc } } + [Produces("application/json")] [ApiController, Route("api/command/[controller]")] public class CommandController : Controller where TCommand : class diff --git a/PoweredSoft.CQRS.AspNetCore/Mvc/QueryController.cs b/PoweredSoft.CQRS.AspNetCore/Mvc/QueryController.cs index 24b8f6e..2302315 100644 --- a/PoweredSoft.CQRS.AspNetCore/Mvc/QueryController.cs +++ b/PoweredSoft.CQRS.AspNetCore/Mvc/QueryController.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; namespace PoweredSoft.CQRS.AspNetCore.Mvc { + [Produces("application/json")] [ApiController, Route("api/query/[controller]")] public class QueryController : Controller where TQuery : class