init
This commit is contained in:
commit
4be274d9e2
39 changed files with 2548 additions and 0 deletions
20
templates/api.py
Normal file
20
templates/api.py
Normal 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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue