File size: 595 Bytes
346376e
625461f
 
f10fdf1
 
10b597c
 
 
625461f
 
 
 
 
10b597c
625461f
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# app.py

from fastapi import FastAPI, Depends, HTTPException
from .routes 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