This project integrates Flask and Kong Gateway to handle upload and download APIs. Follow the steps below to set up and test the system.
Set Up Kong Locally: Start by running Kong locally using Docker with a database. For detailed instructions, refer to the official documentation.
Run Flask App: The app.py contains Flask app which is up and running at https://shivamjagdishsingh.pythonanywhere.com. You can test its status at https://shivamjagdishsingh.pythonanywhere.com/test.
Import Insomnia JSON: Use Insomnia, a tool provided by Kong, or any API testing tool like Postman. Import the provided JSON file to access all the test requests.
Set Up Kong CDN Locally: Configure Kong CDN by creating services and routes. Make the following requests in order:
Create a service:
Create a route:
Test CDN: Your CDN should now be ready for testing. Access http://localhost:8000/pythonanywhere/test to receive a response like this:
This demonstrates Kong CDN redirecting to the main website's test page. Upload and Download: Both upload and download processes are available. Find the corresponding requests in the Insomnia collection under the /flask folder.
- For Download, use a GET request to retrieve a file (e.g., http://localhost:8000/pythonanywhere/download/img2.jpg).
- For Upload, make a POST request with the required parameters, such as name and filename. Refer to the post request in insomina for details.
With these steps completed, you should have successfully set up and tested the KONG-Flask integration for upload and download APIs.๐