-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_api.py
More file actions
51 lines (42 loc) · 1.26 KB
/
Copy pathsimple_api.py
File metadata and controls
51 lines (42 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
"""
Simple API server startup script for testing.
"""
import os
import sys
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent / "src"))
try:
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
import uvicorn
# Create minimal FastAPI app
app = FastAPI(
title="Proposal Master API",
description="Proposal Master System API",
version="1.0.0"
)
# Add CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/")
async def root():
return {"message": "Proposal Master API", "status": "running"}
@app.get("/health")
async def health():
return {"status": "healthy", "api": "running"}
if __name__ == "__main__":
port = int(os.getenv('API_PORT', 8000))
print(f"Starting simple API server on port {port}")
uvicorn.run(app, host="0.0.0.0", port=port, log_level="info")
except Exception as e:
print(f"Error starting API: {e}")
import traceback
traceback.print_exc()