This commit is contained in:
Waylon Walker 2023-05-19 08:35:16 -05:00
commit 4be274d9e2
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
39 changed files with 2548 additions and 0 deletions

20
templates/api.py Normal file
View file

@ -0,0 +1,20 @@
from learn_sql_model.api.app import app
from learn_sql_model.models import Hero
@app.post("/hero/")
def create_hero(hero: Hero) -> Hero:
post(hero)
return hero
@app.get("/hero/")
def read_heroes(hero: Hero) -> list[Hero]:
"read all the heros"
return hero.post()
@app.get("/heros/")
def read_heros() -> list[Hero]:
"read all the heros"
return Hero.get()