diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 08f24cd..2c2f702 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -10,8 +10,9 @@ on: branches: [ "release" ] # Publish semver tags as releases. # tags: [ 'v*.*.*' ] - pull_request: - branches: [ "release" ] + + #pull_request: + #branches: [ "main" ] env: # Use docker.io for Docker Hub if empty diff --git a/main.py b/main.py index 7162e69..0c1643d 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,18 @@ from fastapi import FastAPI +from pydantic import BaseModel app = FastAPI() +# Define a Pydantic model for the input data +class ValueRequest(BaseModel): + name: str + @app.get("/") -async def read_root(): - return {"message": "Hello, World!"} \ No newline at end of file +async def generic_greeter(): + return {"message": "Hello, World!"} + +@app.post("/") +async def named_greeter(request: ValueRequest): + return {"name": request.name, "message": f'Hello, {request.name}'} + +# curl -X POST "http://localhost:8000" -H "Content-Type: application/json" -d '{"name": "YoYo"}'