REST backend for quote app.
-
Clone the repository
-
Create a virtual environment with python 3.8. using command
python3 -m venv venv
- Source virtual environment by
source venv/bin/activate
- Add the environment variables abd install dependencires
export MONGO_DB_PASSWORD=YOUR_DB_PASSWORD
export MONGO_DB_USERNAME=YOUR_USERNAME
pip install -r requirements.txt
python -m spacy download en_core_web_lg
- Run the flask app with development server.
python app.py
To run flask with production server use gunicorn
gunicorn --bind 0.0.0.0:5000 app:app
- To build the docker image locally run
docker build --build-arg mongo_username=YOUR_USERNAME --build-arg mongo_password=YOUR_DB_PASSWORD -t quotes-app .
- To run the docker image locally run
docker run -d -p 9988:5000 quotes-app
The backend is deployed on aws fargate and aws gateway is currently used to terminate https and proxy the request to fargate task.
curl --location --request GET 'https://2zbus46lel.execute-api.ap-south-1.amazonaws.com/v1/quote'
curl --location --request GET 'https://2zbus46lel.execute-api.ap-south-1.amazonaws.com/v1/getRatedQuote'
curl --location --request PUT 'https://2zbus46lel.execute-api.ap-south-1.amazonaws.com/v1/quote/5aa45f317832df00040ac9c0' \
--header 'Content-Type: application/json' \
--data-raw '{
"rating":4
}'
curl --location --request POST 'https://2zbus46lel.execute-api.ap-south-1.amazonaws.com/v1/getRelatedQuote' \
--header 'Content-Type: application/json' \
--data-raw '{"quote":"automating your work is creativity"}'
curl --location --request POST 'https://2zbus46lel.execute-api.ap-south-1.amazonaws.com/v1/quote' \
--header 'Content-Type: application/json' \
--data-raw '{
"quotes":"here and there",
"author":"George O",
"rating":4
}'
- Using flask blue prints.
- Saving intermidate semantic vectors in database so that they can be used for calculation.
- Terminating HTTPS using a Load