@@ -99,21 +99,6 @@ Install dependencies, connect to MongoDB and start your FastAPI server.
99
99
environment variable. You can use `direnv <https://direnv.net/>`__ to
100
100
make this process easier.
101
101
102
- .. step:: Start your FastAPI server
103
-
104
- Run the following code in your terminal to start your FastAPI server:
105
-
106
- .. code-block:: shell
107
-
108
- uvicorn app:app --reload
109
-
110
- After the application is successfully running, you can view it in your
111
- browse by navigating to `<http://127.0.0.1:8000/docs>`__. The following image
112
- shows interface generated by the FastAPI server.
113
-
114
- .. image:: /includes/integrations/fastapi-browser.png
115
- :alt: Screenshot of browser and swagger UI
116
-
117
102
Connect Your Application to Your Cluster
118
103
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
119
104
@@ -469,9 +454,42 @@ These routes are defined in the ``app.py`` file.
469
454
470
455
raise HTTPException(status_code=404, detail=f"Student {id} not found")
471
456
472
- After you complete these steps, you have a working application that
473
- uses FastAPI and the {+driver-async+} to connect to your MongoDB deployment, and
474
- manage student data.
457
+
458
+ Test Your API
459
+ ~~~~~~~~~~~~~
460
+
461
+ After you complete the previous steps, you have a working API that uses
462
+ FastAPI and the PyMongo Async driver to connect to your MongoDB deployment, and
463
+ manage student data. You can use the following steps to send requests to your
464
+ endpoints and see the results.
465
+
466
+ .. procedure::
467
+ :style: connected
468
+
469
+ .. step:: Start your FastAPI server
470
+
471
+ Run the following code in your terminal to start your FastAPI server:
472
+
473
+ .. code-block:: shell
474
+
475
+ uvicorn app:app --reload
476
+
477
+ .. step:: Send requests
478
+
479
+ Navigate to `<http://127.0.0.1:8000/docs>`__. The following image
480
+ shows interface generated by the FastAPI server.
481
+
482
+ .. image:: /includes/integrations/fastapi-browser.png
483
+ :alt: Screenshot of browser and swagger UI
484
+
485
+ Click on the endpoint you would like to send a request to, fill in any
486
+ necessary parameters, and click :guilabel:`Execute`.
487
+
488
+ .. step:: See the results of your requests
489
+
490
+ You can see the results of successful ``POST``, ``PUT`` and ``DELETE``
491
+ requests by navigating to your ``college`` database in `Atlas
492
+ <https://account.mongodb.com/account/login>`__.
475
493
476
494
More Resources
477
495
--------------
0 commit comments