Exposes a REST API for CRUD operations on Lending Service and supports persistence. Designed for containerized deployment and easy local development.
- CRUD operations for inventory items
- Simple JSON REST API
- Validation and error responses
- Configurable data store (e.g., PostgreSQL)
- K8s Friendly
- Git
- K8s (optional for containerized runs)
- A database such as PostgreSQL if not using in-memory store
- Clone the repo:
git clone <repo-url> lendingservice cd inventoryservice
- Configure the Database (see Configuration to update the Postgres DB).
check under deploy folder: postgres-db.yaml sudo iptables -I INPUT -p tcp -s 0.0.0.0/0 --dport 30002 -j ACCEPT oc port-forward lendingdb-postgres-7b588d8896-thjm5 -n assignment 30002:5432 --address <<10.187.168.189>>
- Run the script under "dbpreq" folder.
- Run the service (example for a generic runtime):
# example: go run main.go # or create image using docker build. Refer Quick Start
Build and run with Docker: Refer Docker File //:: Note: For local testing use below line in main.go router.Run("localhost:3002")
//:: For Docker uncomment the below line in main.go //router.Run(":3002")
docker build -t lendingservice .
kubectl create -f postgres-db.yaml
sudo iptables -I INPUT -p tcp -s 0.0.0.0/0 --dport 30002 -j ACCEPT
oc port-forward lendingdb-postgres-7b588d8896-thjm5 -n assignment 30002:5432 --address 192.168.1.5Common environment variables:
- Fill the details in the dbConfig.yaml file
- Base URL: http://localhost:8080
- Refer the Postman Collection under postman folder.