🧪 Personal Project — built for experimentation, fun, or learning.
This is a simple REST API built using .NET 8.0, that handles typical CRUD operations for a ToDo application. The API allows users to create, retrieve, update, delete, and manage ToDo items, with additional functionality like tracking progress and marking items as done.
This ToDo API allows users to manage their ToDo tasks. Each task has the following properties:
- Date and Time of expiry
- Title
- Description
- % Complete
- Create, update, delete, and retrieve ToDo tasks.
- Mark tasks as "Done" and track their progress through a percentage completion.
- Filter tasks for today, next day, and current week.
- .NET 8.0
- Entity Framework Core (EF Core)
- PostgreSQL (for database management)
- xUnit (for unit and integration testing)
- Docker (for containerization)
Before running this project, make sure you have the following installed:
- .NET 8.0 SDK
- Docker (optional, for containerized environment)
- A PostgreSQL database (configured through Docker Compose in the provided
docker-compose.ymlfile)
Clone the repository to your local machine:
git clone https://github.com/calKU0/ToDoAPI.git
cd to-do-apiThe application uses Docker Compose to set up a PostgreSQL database.
Ensure that your appsettings.json file has the following connection string to connect to the Dockerized PostgreSQL database:
{
"ConnectionStrings": {
"DefaultConnection": "Host=db;Database=todo;Username=postgres;Password=password"
}
}This project uses Docker Compose to handle both the API and database.
- Navigate to the project root directory where the
docker-compose.ymlfile is located. - Run the following command to start the services (PostgreSQL and the API):
docker-compose up --buildThis will set up both the database and API container.
Once the containers are up and running, the API will be available at:
http://localhost:8080
The following endpoints are available in the API:
- GET /api/todo: Retrieve all ToDos.
- GET /api/todo/{id}: Retrieve a specific ToDo by ID.
- POST /api/todo: Create a new ToDo.
- PUT /api/todo/{id}: Update an existing ToDo by ID.
- DELETE /api/todo/{id}: Delete a ToDo by ID.
- GET /api/todo/incoming: Get ToDos for today/next day/current week.
Ensure Docker is installed and running. Build the Docker image for the API:
docker build -t todo-api .Make sure your docker-compose.yml file is set up correctly in the root directory, then run:
docker-compose up --buildThis command will start the PostgreSQL database and the API services.
Once everything is up and running, the API will be available at http://localhost:8080.
The project uses xUnit for unit testing. You can run the tests by executing:
dotnet testMake sure your Dockerized PostgreSQL database is running. The integration tests will verify that the API works with the database.