File size: 582 Bytes
8378e62 625461f b6b20ee a9f345d 10b597c 625461f 10b597c 625461f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 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
|