#!/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()