Adding example files
This commit is contained in:
@@ -5,7 +5,7 @@ description = "Add your description here"
|
|||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [
|
authors = [
|
||||||
{name = "Denis Magel", email = "denis.magel@netapp.com"},
|
{name = "Denis Magel", email = "denis.magel@netapp.com"},
|
||||||
{name = "Alexey Mik", email = "alexey.mikhaylov@netapp.com"},
|
{name = "Alexey Mikhaylov", email = "alexey.mikhaylov@netapp.com"},
|
||||||
{name = "Pascal Scheiben", email = "pascal.scheiben@netapp.com"}
|
{name = "Pascal Scheiben", email = "pascal.scheiben@netapp.com"}
|
||||||
]
|
]
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
|
|||||||
3
src/example/__init__.py
Normal file
3
src/example/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from .router import router as example_router
|
||||||
|
|
||||||
|
__all__ = ["example_router"]
|
||||||
2
src/example/constants.py
Normal file
2
src/example/constants.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# contains a constant definition
|
||||||
|
FOO: int = 42
|
||||||
9
src/example/router.py
Normal file
9
src/example/router.py
Normal 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
6
src/example/schema.py
Normal 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
3
src/example/service.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# contains the business logic for the example service
|
||||||
|
async def example_service() -> str:
|
||||||
|
return "This is an example service"
|
||||||
Reference in New Issue
Block a user