26 lines
507 B
C#
26 lines
507 B
C#
|
using Microsoft.EntityFrameworkCore;
|
||
|
using TodoApi.Models;
|
||
|
|
||
|
var builder = WebApplication.CreateBuilder(args);
|
||
|
|
||
|
builder.Services.AddControllers();
|
||
|
builder.Services.AddDbContext<TodoContext>(opt =>
|
||
|
opt.UseInMemoryDatabase("TodoList"));
|
||
|
|
||
|
var app = builder.Build();
|
||
|
|
||
|
if (builder.Environment.IsDevelopment())
|
||
|
{
|
||
|
app.UseDeveloperExceptionPage();
|
||
|
}
|
||
|
|
||
|
app.UseDefaultFiles();
|
||
|
app.UseStaticFiles();
|
||
|
|
||
|
app.UseHttpsRedirection();
|
||
|
|
||
|
app.UseAuthorization();
|
||
|
|
||
|
app.MapControllers();
|
||
|
|
||
|
app.Run();
|