using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Spx.Cor.Exportacao.Api.Core.Startups;
namespace Spx.Cor.Exportacao.Api
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuracao = configuration;
}
public IConfiguration Configuracao { get; }
///
/// This method gets called by the runtime. Use this method to add services to the container.
///
public void ConfigureServices(IServiceCollection servicos)
{
servicos.AddCorsCustomizado(Configuracao);
servicos.AddDommelCustomizado();
servicos.AddMemoryCache();
servicos.AddHealthChecksCustomizado(Configuracao);
servicos.AddAutoMapperCustomizado();
servicos.AddAutenticacaoCustomizada(Configuracao);
servicos.AddMvcCustomizado();
servicos.AddSwaggerCustomizado(Configuracao);
servicos.AddDICustomizado();
servicos.AddLogCustomizado(Configuracao);
}
///
/// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
///
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseCorsCustomizado(env);
app.UseExcecaoCustomizada();
app.UseSwaggerCustomizado();
app.UseHealthChecksCustomizado();
app.UseMvcCustomizado();
app.ConfigureLog(Configuracao);
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}