This repository is a sample ASP.NET Core Web API (.NET 8) project.
The endpoints can be tested using postman or swagger.
Login
Post http://localhost:5000/api/identity/login
Content-Type: application/json
{
"userName": "sara",
"password": "123456"
}
Earn Points
Post http://localhost:5000/api/users/{userId}/earn
Content-Type: application/json
{
"points": 100
}
- ASP.NET Core Web API -v8
- Entity Framework Core -v8
- TDD (Test-Driven Development)
- DDD (Domain-Driven Design)
- Clean Architecture
- Clean Code
- Repository Design Pattern
- CQRS Design Pattern
- Mediator Design pattern
- JWT (JSON Web Token)
- PostgreSQL Database
- Redis for Caching
- Docker
Nuget Packages
- xUnit for unit and integration testing
- Testcontainers for integration testing
- Moq for mocking
- Serilog for logging in console and text file
- FluentValidation for server-side validation
- FluentAssertions for test assertions
- MediatR for implementing mediator pattern
- Mapster for object mapping
- Newtosoft.Json for serializing and deserializing objects
- Microsoft.Extensions.Caching.StackExchangeRedis for implementing redis cache
git clone https://github.com/SaraRasoulian/Loyalty-System-API.git
Make sure docker is installed on your machine.
Run the following command in project directory:
docker-compose up -d
Docker compose in this project includes 4 services:
-
Web API application will be listening at
http://localhost:5000
-
Postgres database will be listening at
http://localhost:5433
-
PgAdmin4 web interface will be listening at
http://localhost:8080
-
Redis cache will be listening at
http://localhost:6379
To apply your modified code, you can add build option:
docker-compose up -d --build
To stop and remove all containers, use the following command:
docker-compose down
Open CustomerLoyalty.sln
file in visual studio, then in package manager console tab, run:
update-database
This command will generate the database schema in postgres container.
Make sure Docker engine is running, before running the integration tests.