You have to clarify that your machine has got next software:
- Docker
- Docker Compose
- Git
- To clone this repository, run the following command:
git clone https://github.com/AMSaiian/TailsAndClaws.git
- Navigate to the repository backend source code folder
cd TailsAndClaws
- Copy .env.example as .env at the same folder - it must be exactly near docker.compose.yml. All generic environment variables have been configured, however you can change it with your own
- Run predefined
docker-compose
script:
docker-compose up --build
You have to clarify that your machine has got next software:
- .NET Core 8
- PostgresSQL 16
- Git
- To clone this repository, run the following command:
git clone https://github.com/AMSaiian/TailsAndClaws.git
- Navigate to the repository backend source code folder
cd TailsAndClaws
- Fill next placeholders in configuration using appsetting.json or .NET user secrets:
ConnectionStrings -> Application
- Run next commands using Powershell or Command line:
dotnet restore TailsAndClaws.sln
dotnet build TailsAndClaws.sln --configuration Release --no-restore
dotnet run --project src/TailsAndClaws/TailsAndClaws.csproj --no-build
- Swagger UI (HTTPS): https://localhost/swagger/index.html (with conventional HTTPS port 443)
- Swagger UI (HTTP): http://localhost/swagger/index.html (with conventional HTTP port 80) !!! due to Swagger UI can't handle redirect, use HTTPS
- The PostgreSQL database is accessible on port 5433 (using Docker run) or on port 5432 (using local run)
- You can get paginated, ordered list of dogs using api/dogs
GET
-endpoint: By default it paginated with amount provided in configuration. Using query params you can define by what property dogs will be sorted; amount of dogs; direction of order. Available order properties:- name
- color
- weight
- tail_length
- You can create a new dog using api/dogs
POST
-endpoint providing next json body payload:{ // required, not empty "name": "DogName", // required, not empty "color": "SomeColor", // required, greater than zero "tail_length_in_meters": 1, // required, greater than zero "weight_in_kg": 1 }
- You can fetch welcome message using api/ping
GET
-endpoint
- Structured logging using Serilog
- Validation pipelines
- Errors and exceptions handlers/filters
- Enhanced solution structure divided on necessary assemblies
- Enhanced configuration observability and its DI for customizing the app behaviour at different layers
- Unit testing using InMemory DbContext and Moq Mocks. Most non-trivial logic was covered with unit-tests
- If you encounter issues with usage of default 80 and 443 ports at
docker compose up
- just changeAPP_HTTP_PORT
andAPP_HTTPS_PORT
ports with free ports at your machine - Don't pay attention to application exceptions, related to error with connection to Postgres DB, during first start.
This is not issue due to during first start there is init of Postgres volume and other heavy processes,
which can make Db container unavailable during some time. Docker Compose of project has been designed to handle this
situation with
"Restart always"
, so just wait some time and then application is going to be ready to work properly - There are some posibility that you encounter issue like provided at screenshot from below. This issue is connected to usage of DEV SSL Certificates, which created during Docker container building. Just accept warning using link highlighted with red.
- Considering the controversial nature of the EF Core usage, these project ignores Repository pattern wrapper for EF DbContext for simplicity and straightforwardness, however author doesn't refuse Repository pattern usage possibility and agrees implementing and maintaining it
- Considering usage of DDD principles in this project, it would be nice to migrate from Anemic domain model to Rich domain model by implementing domain services. However, this step has been skipped for simplicity