Skip to content

Latest commit

 

History

History
61 lines (50 loc) · 2.16 KB

README.md

File metadata and controls

61 lines (50 loc) · 2.16 KB

API Gateways Article Code

Example code from the "API Gateways: Maintainability in the Face of API Complexity" article.

authentication flow

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

Prerequisites

Deploy

Clone this repository

git clone git@github.com:Bajocode/article-apigateways.git
cd article-apigateways
Kubernetes Local Docker Desktop

Ensure Docker and Skaffold are installed

  1. Enable Kubernetes on Docker Desktop
  2. Deploy
skaffold run --port-forward=user

wait 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
  1. The gateway is automatically exposed by skaffold at 0.0.0.0:8080. To do it manually:
kubectl port-forward deployment/gateway 8080
  1. Destroy (optional)
skaffold delete
Docker Compose

Ensure Docker and Docker Compose are installed

  1. Deploy
docker compose up
  1. Destroy (optional)
docker compose down --rmi all