Files
recycling-project-solutions/start_docs.py
T
Aherobo Ovie Victor 89517c541b Add Professional Swagger UI API Documentation
 Professional API Documentation Added:
- Created comprehensive Swagger UI similar to Mini SpecsComply Pro
- Added Flask-RESTX integration with detailed API models
- Professional styling with emojis and comprehensive descriptions

 Dual Documentation System:
- Main API (port 5002): Built-in Swagger at /docs/
- Professional Docs (port 5003): Enhanced UI with detailed specifications
- Complete API coverage: health, info, detection endpoints

 Enhanced API Features:
- Detailed request/response models with validation
- Comprehensive error handling and status codes
- Professional API descriptions and examples
- Health monitoring with system metrics
- Model performance metrics display

 Developer Experience:
- Interactive API testing interface
- Professional documentation layout
- Easy startup with start_docs.py script
- Comprehensive endpoint documentation

 API Endpoints Documented:
- GET /api/v1/health - Health check with metrics
- GET /api/v1/info - Comprehensive API information
- POST /api/v1/detection/upload - File upload detection
- GET /api/v1/detection/hardcoded - Test image detection
- POST /api/v1/detection/base64 - Base64 image detection

Now provides professional API documentation interface matching enterprise standards
2025-07-12 07:37:01 +01:00

68 lines
2.1 KiB
Python
Executable File

#!/usr/bin/env python3
"""
Professional API Documentation Server Launcher
Starts both the main API and the professional Swagger UI documentation.
"""
import subprocess
import time
import sys
import os
def start_main_api():
"""Start the main API server on port 5002."""
print("🚀 Starting Main API Server (Port 5002)...")
return subprocess.Popen([sys.executable, 'main.py'])
def start_swagger_docs():
"""Start the professional Swagger UI documentation on port 5003."""
print("📚 Starting Professional API Documentation (Port 5003)...")
time.sleep(2) # Wait for main API to start
return subprocess.Popen([sys.executable, 'swagger_app.py'])
def main():
"""Start both servers."""
print("=" * 60)
print("🔍 MEMORY MODULE DETECTION API - PROFESSIONAL SETUP")
print("=" * 60)
# Check if virtual environment is activated
if not hasattr(sys, 'real_prefix') and not (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix):
print("⚠️ Warning: Virtual environment not detected!")
print("💡 Recommendation: Run 'source venv/bin/activate' first")
print("")
try:
# Start main API
main_process = start_main_api()
# Start documentation
docs_process = start_swagger_docs()
print("")
print("✅ Both servers started successfully!")
print("")
print("🌐 MAIN API (Web Interface):")
print(" http://localhost:5002")
print("")
print("📚 PROFESSIONAL API DOCS (Swagger UI):")
print(" http://localhost:5003")
print("")
print("🔧 BUILT-IN API DOCS:")
print(" http://localhost:5002/docs/")
print("")
print("Press Ctrl+C to stop both servers...")
# Wait for processes
while True:
time.sleep(1)
except KeyboardInterrupt:
print("\n🛑 Stopping servers...")
main_process.terminate()
docs_process.terminate()
print("✅ Servers stopped successfully!")
if __name__ == '__main__':
main()