REST API for MasterQuiz Frontend app. The API provides CRUD functionality for required endpoints as well as session (Socket) for mutli-user real time quizzes.
Deployed: masterquiz-api.digitalphoenixx.live.
View Endpoints Docs & Sockets Docs.
-
Clone the repo
git clone https://github.com/rameziophobia/masterquiz-backend.git cd masterquiz-backend/
-
Duplicate
.env.example
file and rename it to.env
and fill in the required fields. -
Install requiremnets and start the server.
npm install npm start
To deploy the api to a live/production server. You can either use docker, docker-compose or K8s.
Duplicate .env.example
file and rename it to .env
and fill in the required fields or pass it through command line arguemnts when running docker run
. Change the first part of the tag to your dockerhub id)
docker build -t digitalphoenixx/masterquiz-api:latest .
docker run -p 8000:8000 digitalphoenixx/masterquiz-api:latest
Replace build tag and port used with appropriate values.
Duplicate the .env
file and fill in the data. Replace the port number in the docker-compose.yml
file with preferred port. Then run
docker-compose -f docker-compose.yml -f docker-compose.local.yml up -d
-
Build the image. (change the first part of the tag to your dockerhub id)
docker build -t digitalphoenixx/masterquiz-api:latest .
-
Change the image name in the
.k8s/kustomization.yml
to the tag used in the build step. -
Change the hostname in the
.k8s/ingress.yml
to your domain. -
Create deployment.
kubectl apply -k .k8s/
-
Create the secret with the mongo connection string.
kubectl create secret generic masterquiz-api-secret --from-literal=MONGO_URI="CONNECTION_STRING_HERE" -n masterquiz
-
Check the everything is running, might take a second. Note: Ready is 1/1.
> kubectl get -n masterquiz all NAME READY STATUS RESTARTS AGE pod/masterquiz-api-deployment-85866cc8cf-7rrfj 1/1 Running 0 4h39m NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/masterquiz-api-service ClusterIP 10.108.229.143 <none> 8000/TCP 4h39m NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/masterquiz-api-deployment 1/1 1 1 4h39m NAME DESIRED CURRENT READY AGE replicaset.apps/masterquiz-api-deployment-85866cc8cf 1 1 1 4h39m
- VS Code - Code Editor
- Docker Desktop - Containerization
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Ramez Noshy - Main Dev - rameziophobia
- Mohamed Said Sallam - Main Dev - TheDigitalPhoenixX
See also the list of contributors who participated in this project and their work in CONTRIBUTORS.md.
This project is licensed under the MIT License - see the LICENSE file for details