https://github.com/cloudaeye/product-service-ecommerce-sample-testrca
https://github.com/cloudaeye/product-service-ecommerce-sample-testrca
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.2%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: CloudAEye
- Language: Python
- Default Branch: main
- Size: 6.84 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
Demo E-commerce App - Product Microservice
This project demonstrates a simple e-commerce system built using a micro-services architecture. It consists of one of the service used by this demo app: Product Service: Manages product information, including creation, updates, and retrieval of product details.
Technology Stack
- Backend: Flask (Python)
- Database: MySQL
- Authentication: JWT
Getting Started
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Prerequisites
- Python 3.12+
- Docker and Docker Compose (optional, for containerized deployment)
Installation
- Set up virtual environment (optional)
bash
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install dependencies
Navigate to each service directory and install the required Python packages.
bash
pip install -r requirements.txt
Running the Services
Without Docker
Run the below command from the root path of the dir
bash
export FLASK_APP='src/app.py'
export DATABASE_URL="mysql+pymysql://productname:password@hostname:3306/defaultdb"
flask run --port=5000
The application should be up and running on http://127.0.0.1:5000
With Docker
Run the below command from root path of the dir
bash
export DATABASE_URL="mysql+pymysql://username:password@hostname:3306/defaultdb"
docker build -t ecomm-product-service .
docker run -e DATABASE_URL=$DATABASE_URL -p 5000:5000 ecomm-product-service
The application should be up and running on http://127.0.0.1:5000
API Endpoints
Create a Product (Authenticated)
- POST
/products - Headers:
Authorization: Bearer <JWT_Token> - Payload:
{"name": "New Product", "description": "Product Description", "price": 99.99, "quantity": 100}
- POST
Get All Products (Authenticated)
- GET
/products
- GET
Get a Single Product (Authenticated)
- GET
/products/<product_id>
- GET
Update a Product (Authenticated)
- PUT
/products/<product_id> - Headers:
Authorization: Bearer <JWT_Token> - Payload:
{"name": "Updated Product", "description": "Updated Description", "price": 89.99, "quantity": 150}
- PUT
Delete a Product (Authenticated)
- DELETE
/products/<product_id> - Headers:
Authorization: Bearer <JWT_Token>
- DELETE
Example Requests
- Create a Product (as an authenticated user)
POST http://localhost:5002/products
Headers:
Authorization: Bearer <JWT_Token>
Payload:
json
{
"name": "New Product",
"description": "Product Description",
"price": 99.99,
"quantity": 100
}
Testing
To run unit tests for each service:
bash
export FLASK_APP='src/app.py'
export DATABASE_URL="mysql+pymysql://username:password@hostname:3306/testdb"
export TEST='TRUE'
export USER_SERVICE_URL='http://localhost:5100' # Replace with the actual url
python -m unittest discover tests
Owner
- Name: CloudAEye
- Login: CloudAEye
- Kind: organization
- Email: info@CloudAEye.com
- Location: California, USA
- Website: https://www.cloudaeye.com/
- Repositories: 1
- Profile: https://github.com/CloudAEye
CloudAEye provides AI/ML based intelligent operations management for Cloud services.
GitHub Events
Total
- Issue comment event: 24
- Member event: 2
- Push event: 8
- Pull request review event: 7
- Pull request review comment event: 7
- Pull request event: 2
- Create event: 3
Last Year
- Issue comment event: 24
- Member event: 2
- Push event: 8
- Pull request review event: 7
- Pull request review comment event: 7
- Pull request event: 2
- Create event: 3
Dependencies
- python 3.12.2-slim build
- Flask ==3.0.3
- Flask-JWT-Extended ==4.6.0
- Flask-SQLAlchemy ==3.1.1
- PyJWT ==2.9.0
- SQLAlchemy ==2.0.36
- pymysql *
- python-dotenv *
- requests *