Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using MiniTodo.Data;
- var builder = WebApplication.CreateBuilder(args);
- builder.Services.AddDbContext<AppDbContext>();
- var app = builder.Build();
- app.MapGet("/v1/todos", (AppDbContext context) =>
- {
- var todos = context.Todos;
- return todos is not null ? Results.Ok(todos) : Results.NotFound();
- });
- app.Run();
Advertisement
Add Comment
Please, Sign In to add comment