diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2021-06-05 23:40:37 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2021-06-05 23:40:37 +0530 |
commit | 1a08f6c8d21575ead9755761b28919bf545a7daa (patch) | |
tree | a2903881c6ad4b2b3b69928f2b7cd11dee31432d /app | |
parent | 7c428f8aa39e2142ef1c5f944d759244266eddb0 (diff) |
added example
Diffstat (limited to 'app')
-rw-r--r-- | app/apis.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/apis.py b/app/apis.py index df6ddd1..4c6c3fe 100644 --- a/app/apis.py +++ b/app/apis.py @@ -1,9 +1,20 @@ from api import app - +from app import models from fastapi import Body, FastAPI from fastapi.middleware.wsgi import WSGIMiddleware from pydantic import BaseModel @app.get("/version") async def API_Version(): - return {"message":app.version}
\ No newline at end of file + return {"message":app.version} + +@app.get("/v1/user-details") +async def API_User_Details(email: str): + user = models.User.query.filter_by(email=email).first() + try: + assert user != None + except AssertionError: + return {"message": "User Not Found"} + return { + "first_name":user.first_name, + "last_name":user.last_name}
\ No newline at end of file |