This project implements a REST API for managing street data using ASP.NET Core, Entity Framework Core, PostgreSQL with PostGIS, and Docker. It includes features for creating, modifying, and querying street geometries.
StreetService/
├── Infrastructure/
│ ├── docker-compose.yml
│ └── kubernetes.yaml
├── StreetService/
│ ├── Controllers/
│ │ └── StreetsController.cs
│ ├── Data/
│ │ └── StreetContext.cs
│ ├── Models/
│ │ ├── CreateStreetDto.cs
│ │ ├── ModifyStreetRequest.cs
│ │ └── Street.cs
│ ├── Program.cs
│ └── Startup.cs
└── Dockerfile
-
Clone the repository:
git clone https://github.com/your-username/street-service.git cd street-service
-
Build the Docker image:
docker build -t street-service .
-
Start the application using Docker Compose:
docker-compose up --scale street-service=3
-
Access the API:
- Base URL: http://localhost:5001
- API endpoints:
- POST /api/streets
- GET /api/streets
- PUT /api/streets/{name}/modify
-
Access pgAdmin at: http://localhost:8081
-
Apply the Kubernetes manifest:
kubectl apply -f Infrastructure/kubernetes.yaml
-
Verify deployment:
kubectl get deployments kubectl get pods
- REST API endpoints for creating and querying streets
- Street modification with point addition
- Race condition handling using optimistic concurrency
- Feature flag for database-level vs algorithmic operations
- ASP.NET Core (Controller-based approach)
- Entity Framework Core
- PostgreSQL with PostGIS
- Docker
- Kubernetes
- Controllers: Handles HTTP requests and defines endpoints (StreetsController.cs)
- Program.cs: Entry point for the application
- StreetAPI.csproj: Project file managing dependencies and configuration
- StreetContext.cs: Database context coordinating Entity Framework functionality
- CreateStreetDto.cs: DTO for creating streets
- ModifyStreetRequest.cs: Request model for modifying streets
- PostgreSQL image:
postgis/postgis
- Connection string format:
"DockerConnection": "Host=postgres;Port=5432;Database=streetsdb;Username=postgres;Password=mysecretpassword;"
- Uses separate DTOs for data transfer control
- Implements health checks for database readiness
- Utilizes PostGIS for spatial data handling