Node.js microservice for providing the tv catalog.
OpenAPI documentation available at http://localhost:3001/openapi.
For accessing secured endpoints add your access_token
provided to you at login to the Authorization
header.
npm install
# development
npm run start
# watch mode
npm run start:dev
# production mode
npm run start:prod
# unit tests
npm run test
# e2e tests
npm run test:e2e
# test coverage
npm run test:cov
To run the app in a docker container, run the following commands.
docker network create cinepik-network
docker build -t cinepik-catalog .
docker run -d -t --env-file .env --network cinepik-network -p 3001:3001 cinepik-catalog
To manually upload the image to Docker Hub, run the following commands.
docker build -t cinepik-catalog .
docker tag cinepik-catalog:latest <dockerhub_username>/cinepik-catalog:latest
docker push <dockerhub_username>/cinepik-catalog:latest
You can also setup the database and application with docker-compose.
# Run the application
docker-compose up --build app
docker-compose down
Create a Secret for the movies API environment variable in the deployment file. Replace the value in the <> with the appropriate value. More info here.
kubectl create secret generic catalog-credentials --from-literal=MOVIES_RAPID_API_KEY=<REPLACE_ME>
We can create the deployment and service.
kubectl apply -f k8s/cinepik-catalog.yml
kubectl apply -f k8s/cinepik-catalog-svc.yml
To manually seed the database in Kubernetes, run the following command, which create a Job that runs the seed script.
kubectl apply -f k8s/seed-job.yml
kubectl get pods
kubectl delete deployment cinepik-catalog-deployment
kubectl delete configmap <configmap name>
kubectl rollout restart deployment/cinepik-catalog-deployment
kubectl logs <pod-id>
kubectl describe secret <secret-name>
kubectl get secret <secret-name>
kubectl get service
kubectl describe pods