.
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc.Formatters;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using PartSource.Api.Formatters;
|
||||
using PartSource.Data;
|
||||
using PartSource.Data.AutoMapper;
|
||||
using PartSource.Services;
|
||||
using System.IO;
|
||||
|
||||
namespace PartSource.Api
|
||||
{
|
||||
@@ -23,10 +28,20 @@ namespace PartSource.Api
|
||||
{
|
||||
services.AddMvc(options =>
|
||||
{
|
||||
options.OutputFormatters.Add(new LiquidTemplateOutputFormatter());
|
||||
options.OutputFormatters.RemoveType(typeof(StringOutputFormatter));
|
||||
options.EnableEndpointRouting = false;
|
||||
});
|
||||
|
||||
services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v2", new OpenApiInfo { Title = "Partsource/WHI Integration API", Version = "v2" });
|
||||
|
||||
c.IncludeXmlComments(Path.Combine(System.AppContext.BaseDirectory, "PartSource.Api.xml"));
|
||||
c.IncludeXmlComments(Path.Combine(System.AppContext.BaseDirectory, "PartSource.Data.xml"));
|
||||
});
|
||||
|
||||
services.AddAutoMapper(typeof(PartSourceProfile));
|
||||
|
||||
services.AddTransient<PartService>();
|
||||
services.AddTransient<NexpartService>();
|
||||
services.AddTransient<SecurityService>();
|
||||
@@ -58,7 +73,14 @@ namespace PartSource.Api
|
||||
|
||||
app.UseCors("Default");
|
||||
|
||||
// app.UseExceptionHandler("/Error");
|
||||
app.UseSwagger();
|
||||
app.UseReDoc(c =>
|
||||
{
|
||||
c.SpecUrl = "/swagger/v2/swagger.json";
|
||||
c.ExpandResponses(string.Empty);
|
||||
});
|
||||
|
||||
// app.UseExceptionHandler("/Error");
|
||||
// app.UseHttpsRedirection();
|
||||
app.UseMvc();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user