feat(api): use routers for different api routes
This commit is contained in:
parent
285d11c0ab
commit
363aa37365
0
backend/src/neo_neo_todo/control/__init__.py
Normal file
0
backend/src/neo_neo_todo/control/__init__.py
Normal file
8
backend/src/neo_neo_todo/control/control.py
Normal file
8
backend/src/neo_neo_todo/control/control.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
from fastapi import APIRouter
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/control", tags=["control"])
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/ping")
|
||||||
|
async def ping():
|
||||||
|
return {"ping": "pong"}
|
@ -1,8 +1,8 @@
|
|||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
|
|
||||||
|
from src.neo_neo_todo.control import control
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
|
|
||||||
@app.get("/control/ping")
|
app.include_router(control.router)
|
||||||
async def root():
|
|
||||||
return {"ping": "pong"}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user