2023-04-12 22:30:42 +08:00
|
|
|
|
using Furion;
|
|
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
using Microsoft.Extensions.Hosting;
|
2023-04-15 17:33:42 +08:00
|
|
|
|
using Yi.Furion.Web.Core.Handlers;
|
2023-04-12 22:30:42 +08:00
|
|
|
|
|
2023-04-15 17:33:42 +08:00
|
|
|
|
namespace Yi.Furion.Web.Core;
|
2023-04-12 22:30:42 +08:00
|
|
|
|
|
|
|
|
|
|
public class Startup : AppStartup
|
|
|
|
|
|
{
|
|
|
|
|
|
public void ConfigureServices(IServiceCollection services)
|
|
|
|
|
|
{
|
|
|
|
|
|
services.AddConsoleFormatter();
|
|
|
|
|
|
services.AddJwt<JwtHandler>();
|
|
|
|
|
|
|
|
|
|
|
|
services.AddCorsAccessor();
|
|
|
|
|
|
|
2023-04-15 14:36:48 +08:00
|
|
|
|
services.AddControllers().AddInjectWithUnifyResult();
|
2023-04-13 21:12:06 +08:00
|
|
|
|
|
|
|
|
|
|
services.AddEventBus();
|
2023-04-12 22:30:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|