The ToDoList application is a simple task management system that allows users to create, read, update, and delete to-do items. It uses ASP.NET Core for the backend and Entity Framework Core for data access.
I feel pleased with the layout of the project in that it follows a Domain Driven Design for its layers. Also I am pleased with the tests although maybe some more true end-to-end tests wouldn’t go amiss. As mentioned in the front-end readme this API is very naive in that there is light security and no concept of Users and their associated accounts. Again some sort of integration with Okta or Entra would be my choice to have some sort of token and claims based authentication to validate users. I also decided to try and make the search a little more elaborate by incorporating FuzzySharp but it could be argued for such a small app linq .Contains functionality might have been enough.
The logging on this project is deliberately poor, I took the approach of allowing errors to bubble up to the controller layer and then logging them to the console and sending back a generic 500 http response. In real life I would be looking at some centralised logging like Sentry or Logrocket, also more nuanced http returns could be used. Plugging in Application Insights would be a good shout as well. The sub project layers are also harder to reuse as a result as they do not perform any logging or error handling, so any application reusing them out of context would have to account for that.
- Add new to-do items
- View all to-do items
- Update existing to-do items
- Delete to-do items
- Caching for improved performance
- ASP.NET Core
- Entity Framework Core
- Microsoft.Extensions.Caching.Memory
- SQL Server (or any other supported database)
- Dependency Injection
- FuzzySharp for the fuzzy searching functionality. https://github.com/JakeBayer/FuzzySharp
ToDoList
├── ToDoList.Domain
│ ├── Interfaces
│ │ └── IToDoRepository.cs
│ ├── Models
│ │ └── ToDoItem.cs
├── ToDoList.Application
│ ├── Services
│ │ └── ToDoService.cs
├── ToDoList.Infrastructure
│ ├── Repositories
│ │ └── ToDoRepository.cs
│ ├── Data
│ │ └── AppDbContext.cs
├── ToDoList.API
│ ├── Controllers
│ │ └── ToDoController.cs
│ ├── Program.cs
│ ├── Startup.cs
- .NET 6 SDK or later
- SQL Server (or any other supported database)
- Clone the repository:
git clone https://github.com/yourusername/ToDoList.git
cd ToDoList
- Update the database connection string in
appsettings.json
:
"ConnectionStrings": {
"DefaultConnection": "Server=your_server;Database=ToDoListDb;User Id=your_user;Password=your_password;"
}
- Apply migrations and create the database:
dotnet ef database update
- Run the application: Either run the project from the command line, if you do be sure to update the front end project .env file to use port 5274 over http
dotnet run --project ToDoList.API
Or use VS 2022 debug option, in which case make sure the front end app uses https and port 7207.
- The API will be available at
https://localhost:5001
orhttp://localhost:5000
. - Use tools like Postman or Swagger to interact with the API endpoints.
GET /api/todo
- Get all to-do itemsGET /api/todo/{id}
- Get a to-do item by IDPOST /api/todo
- Add a new to-do itemPUT /api/todo/{id}
- Update an existing to-do itemDELETE /api/todo/{id}
- Delete a to-do item by ID
Contributions are welcome! Please open an issue or submit a pull request.