Skip to content

Commit

Permalink
squash! Add endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
trallnag committed Aug 16, 2022
1 parent 4421038 commit 4cf10d2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/testbench_tuna/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Union

from fastapi import FastAPI
from fastapi import FastAPI, HTTPException

from . import utils

Expand All @@ -15,3 +15,13 @@ async def get_root():
@app.get("/pizza-size")
async def get_pizza_size(diameter: Union[int, float]):
return {"area": utils.pizza_size(diameter)}


@app.get("/users/{username}/email")
async def get_users_username_email(username: str):
if username == "foo":
return {"username": username, "email": "foo@example.com"}
elif username == "bar":
return {"username": username, "email": "bar@example.com"}
else:
raise HTTPException(status_code=404, detail="User not found")

0 comments on commit 4cf10d2

Please sign in to comment.