Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESTful API for E-Commerce Platform

Project Structure

|   .env                         # Environment variables i.e. AUTH_TOKEN, DATABASE_URL
|   docker-compose.yaml          # Docker Compose file
|   Dockerfile                   # Docker file for api service
|   example.py                   # Example API calls
|   README.md
|   requirements.txt             # Python dependencies
|   
+---app
|   +---api
|   |   |   endpoints.py         # API endpoints
|   |   |   __init__.py          # API server
|   |   |   
|   |           
|   +---db
|   |   |   __init__.py          # Database connection
|   |   |   
|   |   +---models               # SQLAlchemy models
|   |   |   |   order.py         # Order model
|   |   |   |   order_product.py # Order-Product model i.e. with quantity
|   |   |   |   product.py       # Product model
|   |   |   |   __init__.py
|   |   |   |   
|   |   |           
|   |           
|   +---schemas                  # Pydantic schemas
|   |   |   order.py             # Order schemas
|   |   |   product.py           # Product schemas
|   |   |   __init__.py
|   |   |   
|   |           
|   +---services                 # Services
|   |   |   __init__.py          # Core logic for creating products, orders
|   |   |   
|   |           
|   \---utils                    # Utility functions
|       |   auth_utils.py        # Auth utils
|       |   exceptions.py        # Exception classes
|       |   __init__.py
|       |   
|               
+---config                       # Config manager for .env file
|   |   __init__.py
|   |   
|           
\---tests                        # Tests
    |   test_endpoints.py        # Test cases for API endpoints
    |   __init__.py
    |   

Usage / Manual Tests

  1. docker compose down --remove-orphans --volumes && docker compose up --build api
  2. Wait till the app is up and running^
  3. python example.py

Above example.py contains API calls cases ~ for creating products, getting all products, creating orders

Automated Tests

  1. docker compose down --remove-orphans --volumes && docker compose up --build api_tests

NOTE: .env contains AUTH_TOKEN which is used for authentication. This is not a real token, it is just for testing purposes.

Docs

/docs api_docs_testing

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages