A TypeScript API for demonstration purposes
- Node 18+
- Docker
- Docker Compose
Install dependencies:
npm install
Execute unit tests:
npm test
Execute unit tests in watch mode:
npm run tdd
Execute spec tests to verify the API conforms to its OpenAPI specification:
npm run test-spec
Execute benchmark tests to measure throughput:
npm run test-benchmark
Execute component tests to verify end-to-end behavior using mocked dependencies:
npm run test-component
Execute verification tests to verify end-to-end behavior against the deployed service:
npm run test-verification
Run the api in watch mode:
npm run watch
Run the api in a container in watch mode:
npm run compose-dev
Build the Docker image:
docker build -t demo-api .
- Minikube
- Kubectl
- Helm
Start a minikube cluster:
minikube start --driver=docker --cpus='max' --memory='max'
Build the Docker image and load it into the minikube cluster:
docker build -t demo-api .
minikube image load demo-api
Install the Helm chart into the cluster:
helm install demo-api ./charts/demo-api -f ./charts/demo-api/values.yaml
Forward local port 3000 to the service's port 80:
kubectl port-forward svc/demo-api 3000:80
Make a request to the service in another terminal:
curl http://localhost:3000/api/echo