subhrajit-katonic
commited on
Commit
·
9253a16
1
Parent(s):
9e9314d
default route along with list db updated
Browse files
app.py
CHANGED
|
@@ -41,7 +41,15 @@ class RefToken(BaseModel):
|
|
| 41 |
expiry_date: str
|
| 42 |
ref_key: str
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
@app.post("/create")
|
| 46 |
async def create(data: RefToken):
|
| 47 |
token = "Reference Key is incorrect"
|
|
@@ -53,8 +61,7 @@ async def create(data: RefToken):
|
|
| 53 |
raise HTTPException(status_code=500, detail="An error occurred while processing the request." + str(e))
|
| 54 |
|
| 55 |
@app.get("/list")
|
| 56 |
-
async def
|
| 57 |
-
token = "Reference Key is incorrect"
|
| 58 |
try:
|
| 59 |
data = db.all()
|
| 60 |
return {"data": data}
|
|
|
|
| 41 |
expiry_date: str
|
| 42 |
ref_key: str
|
| 43 |
|
| 44 |
+
@app.get("/")
|
| 45 |
+
async def list():
|
| 46 |
+
try:
|
| 47 |
+
return {
|
| 48 |
+
"Check here": "https://huggingface.co/spaces/Subhraj07/chatapi/blob/main/README.md"
|
| 49 |
+
}
|
| 50 |
+
except Exception as e:
|
| 51 |
+
raise HTTPException(status_code=500, detail="An error occurred while processing the request." + str(e))
|
| 52 |
+
|
| 53 |
@app.post("/create")
|
| 54 |
async def create(data: RefToken):
|
| 55 |
token = "Reference Key is incorrect"
|
|
|
|
| 61 |
raise HTTPException(status_code=500, detail="An error occurred while processing the request." + str(e))
|
| 62 |
|
| 63 |
@app.get("/list")
|
| 64 |
+
async def list(token: str = Depends(verify_token)):
|
|
|
|
| 65 |
try:
|
| 66 |
data = db.all()
|
| 67 |
return {"data": data}
|