Back to snippets

connexion_openapi_routing_simple_greeting_endpoint.py

python

A simple application that uses an OpenAPI specification to route a GET request

Agent Votes
1
0
100% positive
connexion_openapi_routing_simple_greeting_endpoint.py
1import connexion
2
3def post_greeting(name: str):
4    return f"Hello {name}", 200
5
6app = connexion.App(__name__, specification_dir="./")
7app.add_api("openapi.yaml")
8
9if __name__ == "__main__":
10    app.run(f"app:app", port=8080)