20 lines
455 B
Python
20 lines
455 B
Python
from fastapi import APIRouter
|
|
from app.services.example_service import ExampleService
|
|
|
|
router = APIRouter()
|
|
service = ExampleService()
|
|
|
|
|
|
@router.get("/examples")
|
|
async def list_examples():
|
|
return await service.list_all()
|
|
|
|
|
|
@router.get("/examples/{example_id}")
|
|
async def get_example(example_id: str):
|
|
return await service.get_by_id(example_id)
|
|
|
|
|
|
@router.post("/examples")
|
|
async def create_example(data: dict):
|
|
return await service.create(data) |