A minimal RESTful API for managing todo items using ASP.NET Core Minimal APIs, Entity Framework Core, and SQLite.
- Create, Read, Delete Todo items
- Uses Entity Framework Core for persistence
- SQLite as lightweight database
- Clean and minimal code structure
- Auto-migration support on startup
- .NET 8
- ASP.NET Core Minimal APIs
- Entity Framework Core
- SQLite (In-process database)
- C#
Follow these steps to run the project on your local machine:
- Clone the Repository
git clone https://github.com/yourusername/todo-minimal-api.git
cd todo-minimal-api- Install EF Core CLI (if not installed)
dotnet tool install --global dotnet-ef- Restore Project Dependencies
dotnet restore- Apply Database Migrations
dotnet ef migrations add InitialCreateThen apply the migration:
dotnet ef database update
⚠️ If the migration already exists, you can skip theadd InitialCreatestep.
- Run the API
dotnet runThe app will start on
http://localhost:5000or another port shown in your terminal.
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Get all todos |
| GET | /todo/{id} |
Get a todo by ID |
| POST | /todo |
Create a new todo |
| DELETE | /todo/{id} |
Delete a todo by ID |
{
"id": 1,
"name": "Finish .NET API",
"duedate": "2025-04-01T00:00:00",
"isComplete": false
}📁 TodoCRUD/
├── Program.cs # Minimal API and endpoints
├── Todo.cs # Model class
├── TodoDbContext.cs # EF Core DB context
├── Migrations/ # EF Core migration files
└── README.md # Project documentation
- Add update (PUT/PATCH) endpoint
- Add input validation
- Add unit tests
MIT License. Use freely in your own projects!
Created by Asela Priyadarshana