This is a Web service and REST API service to shorten a very long url.
pip3 install -r requirements.txt
pytest -v
python3 flask_runner.py- Open the browser
http://localhost:8080/
- Open a terminal
python3 flask_rest_api.py - Open a new terminal and call curl commands Eg:
curl http://localhost:8080/ -X POST -d '{"long_url": "http://thisistesting.com/"}'
- Build the docker image
docker build -t url_shortner .or Download fromdocker pull sbalasa/url_shortner:2021 - Verify if the image is created/available
docker image ls - Run it in a Docker container
docker run url_shortnerordocker run sbalasa/url_shortner:2021(if image is downloaded from docker hub) - Open a new terminal and call curl commands Eg:
curl http://<ip shown by the container>:8080/ -X POST -d '{"long_url": "http://thisistesting.com/"}'