Example code from the "API Gateways: Maintainability in the Face of API Complexity" article.
| Service | Language | Description |
|---|---|---|
| gateway | Helm / Yaml | API Gateway that forwards clients to the micro-services, handles JWT validation, terminates tls and transforms url paths |
| cart-service | Go | Manages shopping carts for registered customers |
| identity-service | Typescript | Manages customer accounts and signs JWTs (symmetric HMAC), while hosting a JSON Web Key set (JWK) to offload authorization to gateway |
Clone this repository
git clone git@github.com:Bajocode/article-apigateways.git
cd article-apigatewaysEnsure Docker and Skaffold are installed
- Enable Kubernetes on Docker Desktop
- Deploy
skaffold run --port-forward=userwait and verify all helmcharts have been deployed
kubectl get pods
NAME READY STATUS RESTARTS AGE
cart-service-7b9695d479-s2r4t 1/1 Running 0 8m1s
gateway-87cf57767-47qnc 1/1 Running 0 7m34s
identity-service-567685c7b6-mcx68 1/1 Running 0 7m52s
- The gateway is automatically exposed by skaffold at
0.0.0.0:8080. To do it manually:
kubectl port-forward deployment/gateway 8080- Destroy (optional)
skaffold deleteEnsure Docker and Docker Compose are installed
- Deploy
docker compose up- Destroy (optional)
docker compose down --rmi all