using DocumentServiceAPI.Core;
|
using DocumentServiceAPI.Model;
|
using Furion;
|
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.Hosting;
|
using System.Text.Encodings.Web;
|
using System.Text.Json.Serialization;
|
using System.Text.Unicode;
|
|
namespace DocumentServiceAPI.Web.Core;
|
|
public class Startup : AppStartup
|
{
|
public void ConfigureServices(IServiceCollection services)
|
{
|
services.AddConsoleFormatter();
|
services.AddJwt<JwtHandler>();
|
|
services.AddCorsAccessor();
|
|
services.AddControllers().AddJsonOptions(options =>
|
{
|
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
|
// options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Create();
|
}); ;
|
services.AddInjectWithUnifyResult<DSRESTFulResultProvider>();
|
|
}
|
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
{
|
if (env.IsDevelopment())
|
{
|
app.UseDeveloperExceptionPage();
|
}
|
|
// app.UseHttpsRedirection();
|
|
app.UseRouting();
|
|
app.UseCorsAccessor();
|
|
app.UseAuthentication();
|
app.UseAuthorization();
|
|
app.UseInject(string.Empty);
|
|
app.UseEndpoints(endpoints =>
|
{
|
endpoints.MapControllers();
|
});
|
}
|
}
|