A high-performance, scalable TODO API built with .NET Core and gRPC. This project demonstrates efficient request handling using CancellationToken for asynchronous operations, allowing graceful cancellation of long-running tasks. The API implements standard CRUD operations for managing TODO items with enhanced cancellation support.
- CRUD Operations: Create, Read, Update, and Delete TODO items.
- Cancellation Token Support: Supports graceful cancellation of long-running operations.
- Scalability: Designed to handle growing data and manage asynchronous requests efficiently.
- Logging: Console logging for request lifecycle tracking.
- Asynchronous Programming: Built using
async/await
for better performance and responsiveness.
- URL:
/api/todoitem/GetAllWithoutCancellationToken
- Method:
GET
- Description: Fetches all TODO items without cancellation support. Useful for testing basic CRUD functionality.
GET http://localhost:5000/api/todoitem/GetAllWithoutCancellationToken
- URL:
/api/todoitem
- Method:
GET
- Description: Fetches all TODO items with cancellation support.
GET http://localhost:5000/api/todoitem
- URL:
/api/todoitem/{id}
- Method:
GET
- Description: Retrieves a specific TODO item by its unique ID.
GET http://localhost:5000/api/todoitem/1
- URL:
/api/todoitem
- Method:
POST
- Description: Creates a new TODO item.
POST http://localhost:5000/api/todoitem
Content-Type: application/json
{
"title": "New Task",
"isCompleted": false
}
- URL:
/api/todoitem/{id}
- Method:
PUT
- Description: Updates an existing TODO item by its ID.
PUT http://localhost:5000/api/todoitem/1
Content-Type: application/json
{
"id": 1,
"title": "Updated Task",
"isCompleted": true
}
- URL:
/api/todoitem/{id}
- Method:
DELETE
- Description: Deletes a specific TODO item by its ID.
DELETE http://localhost:5000/api/todoitem/1
- .NET Core 5.0+
- Visual Studio or any preferred code editor.
- Postman or any HTTP client for testing endpoints.
-
Clone the repository:
git clone https://github.com/yourusername/todo-api-with-cancellation-support.git
-
Navigate to the project folder:
cd todo-api-with-cancellation-support
-
Restore the dependencies:
dotnet restore
-
Run the project:
dotnet run
-
The API will be accessible at
http://localhost:5000
.
Tests can be run using the following command:
dotnet test
- Fork this repository.
- Create a new branch (
git checkout -b feature-name
). - Make your changes.
- Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-name
). - Create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- .NET Core: For providing a powerful platform to build scalable APIs.
- gRPC: For efficient, low-latency communication in distributed systems.
Feel free to contribute or use this API as a base for building your own gRPC-based applications!
- Overview: A brief introduction to the project and its key features, including cancellation token support.
- API Endpoints: A section outlining the available API endpoints, their HTTP methods, and descriptions.
- Project Setup: Instructions on how to set up and run the project locally.
- Testing: How to run tests if applicable.
- Contributing: Instructions for others to contribute to the project.
- License: Information about the license under which the project is distributed.