# main.py | |
from fastapi import FastAPI, Depends, HTTPException | |
import auth, tts | |
from auth import verify_token # Import a function for verifying tokens | |
app = FastAPI() | |
# Include the authentication router with the prefix '/auth' | |
app.include_router(auth.router, prefix="/auth") | |
# Include the TTS router with the prefix '/tts' | |
app.include_router(tts.router, prefix="/tts") | |
# Dependency for verifying the user's token | |
def get_current_user(token: str = Depends(verify_token)): | |
if not token: | |
raise HTTPException(status_code=401, detail="Token not valid") | |
return token | |