This project is a simple Flask-based API for managing and querying order data.
- Python 3.7 or higher
pip(Python package manager)
If you haven't already, clone this repository and navigate to the project directory:
git clone <repository-url>It is recommended to use a virtual environment to manage dependencies:
python3 -m venv venvActivate the virtual environment:
- On Linux/macOS:
source venv/bin/activate - On Windows:
venv\Scripts\activate
Install the required Python packages using pip:
pip install -r requirements.txtStart the Flask server:
python server.pyThe API will be available at http://0.0.0.0:5000/.
/— Root endpoint/orders— Get all orders/orders/count— Get the number of orders/orders/<order_id>— Get order by ID/orders/sum— Get the sum of all products in all orders/orders/<order_id>/sum— Get the sum of all products in a specific order/orders/most_bought— Get the most bought product
- The API reads data from
orders_mock.jsonby default. - Make sure
orders_mock.jsonis present in the project directory.
Feel free to modify and extend the API as needed.