It is a backend service that provides endpoints for my Pomodoro SPA.
- CRUD operations for tasks.
- Cookie-based authentication.
- Support for RESTful API design principles.
- I'm planning to add more features in the future.
- ASP.NET 8
- C#
- Entity Framework Core
- MariaDB
- Docker
- xUnit
- docker
- .NET 8 SDK
- dotnet-ef
Clone the project.
git clone <link>
Install Entity Framework Core.
dotnet tool install --global dotnet-ef
Install dependencies.
dotnet restore
Run the migrations.
dotnet ef database update --project ./PomodoroApi
Run the main project.
dotnet run --project ./PomodoroApi
The project uses environment and secret files in compose.yml
. So you have to set them up.
First, create a secrets
directory. Then, create the following files.
- db_connection_string.txt - contains the database connection information.
- db_password.txt - contains the password of the database.
# db_connection_string.txt
# this is the sample connection string for MariaDB.
Server=Your_Host;Database=Your_Database_Name;Uid=Your_User;Pwd=Your_Password
# db_password.txt
YourSuperSecretPassword
Lastly, create the .env
file.
(Optional) If you're using Linux. You can simply run the command cp .env.example .env
to create the file in your directory.
# .env
CONNECTION_STRING=
DB_PASSWORD=YourSuperSecretPassword
After that, you can use the following command to create and start containers.
docker compose up --build
Now, go to http://localhost:5174/swagger/index.html to test it out.
Use the command dotnet test
to run all the tests.