-
-
Save tebeka/43d2c56bfe07e1b2dc78efd2b58fd587 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.get("/users/{user_id}") | |
def get_user(user_id): | |
user = app.state.db.get_user(user_id) | |
if user is None: | |
raise HTTPException(HTTPStatus.NOT_FOUND) | |
data = json.dumps(asdict(user)) | |
return Response(data, media_type='application/json') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment