Adding example files

This commit is contained in:
Pascal Scheiben
2025-09-18 08:39:47 +02:00
parent 04054f181e
commit bcc2bc9678
6 changed files with 24 additions and 1 deletions

3
src/example/__init__.py Normal file
View File

@@ -0,0 +1,3 @@
from .router import router as example_router
__all__ = ["example_router"]

2
src/example/constants.py Normal file
View File

@@ -0,0 +1,2 @@
# contains a constant definition
FOO: int = 42

9
src/example/router.py Normal file
View File

@@ -0,0 +1,9 @@
# contains the router for the example endpoint
from fastapi import APIRouter
from .schema import ExampleSchema
router = APIRouter(tags=["example"])
@router.get("/example")
async def example_endpoint() -> ExampleSchema:
return ExampleSchema(example_field="foo", another_field=42)

6
src/example/schema.py Normal file
View File

@@ -0,0 +1,6 @@
# contains the schema definitions for the example service
from pydantic import BaseModel
class ExampleSchema(BaseModel):
example_field: str
another_field: int

3
src/example/service.py Normal file
View File

@@ -0,0 +1,3 @@
# contains the business logic for the example service
async def example_service() -> str:
return "This is an example service"