NET-Web-API-w-Angular/Program.cs

29 lines
No EOL
646 B
C#
Executable file

using Microsoft.EntityFrameworkCore;
using Api.Models;
var builder = WebApplication.CreateBuilder(new WebApplicationOptions {
Args = args,
WebRootPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "dist", "wwwroot", "browser")
});
builder.Services.AddControllers();
builder.Services.AddDbContext<Context>(opt =>
opt.UseInMemoryDatabase("List"));
var app = builder.Build();
if (builder.Environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();