mirror of
https://github.com/LukeHagar/connexion.git
synced 2025-12-06 04:19:26 +00:00
Update the import statements for the cookbook snippets (#1805)
Updates the import statements on https://connexion.readthedocs.io/en/stable/cookbook.html A few of the import statements were missing, or didn't match the example code because they imported at the wrong depth. This should make the code in the cookbook copy-pasteable. --------- Co-authored-by: Robbe Sneyders <robbe.sneyders@gmail.com>
This commit is contained in:
@@ -17,12 +17,14 @@ Starlette. You can add it to your application, ideally in front of the ``Routing
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from connexion import AsyncApp
|
||||
from connexion.middleware import MiddlewarePosition
|
||||
from starlette.middleware.cors import CORSMiddleware
|
||||
|
||||
|
||||
app = connexion.AsyncApp(__name__)
|
||||
app = AsyncApp(__name__)
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
@@ -49,12 +51,14 @@ Starlette. You can add it to your application, ideally in front of the ``Routing
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from connexion import FlaskApp
|
||||
from connexion.middleware import MiddlewarePosition
|
||||
from starlette.middleware.cors import CORSMiddleware
|
||||
|
||||
|
||||
app = connexion.FlaskApp(__name__)
|
||||
app = FlaskApp(__name__)
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
@@ -81,9 +85,11 @@ Starlette. You can add it to your application, ideally in front of the ``Routing
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from asgi_framework import App
|
||||
from connexion import ConnexionMiddleware
|
||||
from connexion.lifecycle import ConnexionRequest, ConnexionResponse
|
||||
from starlette.middleware.cors import CORSMiddleware
|
||||
|
||||
app = App(__name__)
|
||||
app = ConnexionMiddleware(app)
|
||||
|
||||
Reference in New Issue
Block a user