40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
// Startup.cs
|
|
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Hosting;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
namespace FreelancerListServer
|
|
{
|
|
public class Startup
|
|
{
|
|
public void ConfigureServices(IServiceCollection services)
|
|
{
|
|
services.AddControllers().AddNewtonsoftJson(); // Für JSON-Serialisierung
|
|
services.AddSingleton<LiteDbManager>();
|
|
services.AddSingleton<Logger>();
|
|
services.AddCors(options =>
|
|
{
|
|
options.AddPolicy("AllowAll", builder =>
|
|
{
|
|
builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader();
|
|
});
|
|
});
|
|
}
|
|
|
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
|
{
|
|
if (env.IsDevelopment())
|
|
{
|
|
app.UseDeveloperExceptionPage();
|
|
}
|
|
|
|
app.UseRouting();
|
|
app.UseCors("AllowAll");
|
|
app.UseEndpoints(endpoints =>
|
|
{
|
|
endpoints.MapControllers();
|
|
});
|
|
}
|
|
}
|
|
} |