Files
dtrack-defectdojo-automation/snippets/websrv/main.py
Wolfgang Hottgenroth 921a784fc0
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
add webservice boilerplate snippet
2025-07-14 17:58:43 +02:00

34 lines
738 B
Python

from fastapi import FastAPI
from fastapi.responses import JSONResponse
app = FastAPI(
title="My FastAPI App",
version="1.0.0",
description="A simple FastAPI example with uvicorn and gunicorn."
)
@app.get("/hello")
async def say_hello(name: str):
"""
Returns a friendly greeting.
---
parameters:
- name: name
in: query
required: true
schema:
type: string
responses:
200:
description: Successful Response
content:
application/json:
schema:
type: object
properties:
message:
type: string
"""
return JSONResponse(content={"message": f"Hello, {name}!"})