Loginauth / app.py
Gregniuki's picture
Update app.py
625461f
raw
history blame
602 Bytes
# main.py
from fastapi import FastAPI, Depends, HTTPException
from app.routes import auth, tts
from app.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