This project is a simple Flask application for managing orders and items. It demonstrates the usage of a factory function to create the Flask application, grouping routes using Blueprints, and using SQLite3 as the database.
- Create, read, and delete orders
- Each order can contain multiple items
- Uses SQLite3 as the database
- Organized code structure with factory function and Blueprints
- Python 3.x
- Flask
- SQLite3
- Activate the virtual environment:
source venv/bin/activate
- Set the Flask application:
export FLASK_APP=flask-orders-api export FLASK_ENV=development
- Run the application:
flask run
curl -X POST http://127.0.0.1:5000/create -H "Content-Type: application/json" -d '{"CustomerID": "C001", "Items": "Item1, Item2", "ShippedAt": "2023-06-11 12:00:00", "CompletedAt": "2023-06-15 15:00:00"}'
curl -X GET http://127.0.0.1:5000/list/1
curl -X DELETE http://127.0.0.1:5000/delete/1
docker buildx build -t flask-orders-api .
Note: docker-buildx
is new and recommended builder to use for building docker images.
docker run -p 5000:5000 flask-orders-api:latest