Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,19 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
from
|
|
|
|
|
4 |
|
5 |
app = FastAPI()
|
6 |
|
7 |
-
#
|
8 |
-
app.
|
|
|
|
|
|
|
9 |
|
10 |
-
#
|
11 |
-
|
12 |
-
|
|
|
|
|
|
1 |
+
# main.py
|
2 |
+
|
3 |
+
from fastapi import FastAPI, Depends, HTTPException
|
4 |
+
from app.routes import auth, tts
|
5 |
+
from app.auth import verify_token # Import a function for verifying tokens
|
6 |
|
7 |
app = FastAPI()
|
8 |
|
9 |
+
# Include the authentication router with the prefix '/auth'
|
10 |
+
app.include_router(auth.router, prefix="/auth")
|
11 |
+
|
12 |
+
# Include the TTS router with the prefix '/tts'
|
13 |
+
app.include_router(tts.router, prefix="/tts")
|
14 |
|
15 |
+
# Dependency for verifying the user's token
|
16 |
+
def get_current_user(token: str = Depends(verify_token)):
|
17 |
+
if not token:
|
18 |
+
raise HTTPException(status_code=401, detail="Token not valid")
|
19 |
+
return token
|