forked from chai-dev682/plivo-interview-phone-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanage.py
More file actions
44 lines (37 loc) · 1.14 KB
/
manage.py
File metadata and controls
44 lines (37 loc) · 1.14 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
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from contextlib import asynccontextmanager
import uvicorn
from app.routers.interview import router as interview_router
from app.routers.call import router as call_router
from app.services.mysql import mysql_service
@asynccontextmanager
async def lifespan(app: FastAPI):
# Startup: Initialize services
mysql_service.initialize()
yield
# Shutdown: Clean up resources if needed
pass
# Create FastAPI app
app = FastAPI(
title="Interview API",
description="API for managing automated phone interviews",
version="1.0.0",
lifespan=lifespan
)
# Configure CORS
app.add_middleware(
CORSMiddleware,
# In production, replace with specific origins
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(interview_router)
app.include_router(call_router)
@app.get("/")
async def health_check():
return {"status": "success", "description": "API for managing automated phone interviews"}
if __name__ == "__main__":
uvicorn.run("manage:app", host="0.0.0.0", port=5000, reload=True)