What:
Domino’s Simple FastAPI example is a great way to get started with FastAPI in Domino, but what if you’re ready to go a step further and set up a FastAPI app to take multiple GET and POST requests? This guide assumes you’ve already installed FastAPI in your environment or set it up to install via requirements.txt.How:
app.sh
Like many of our other App examples, this simply calls the Python script:Python script
First, we need to import our packages and collect some environment variables:/username/app-name/app). Therefore, we need to set a root_path for our FastAPI app (see https://fastapi.tiangolo.com/advanced/behind-a-proxy/#setting-the-root_path-in-the-fastapi-app). With that example in mind, I was able to get to the swagger UI by modifying our code example as follows:
http://<your-domino-url>/<user>/<project>/r/notebookSession/<session_id> (see App URLS and URL parameters). To find this easily, you might add a print statement to your app.py, such as:
http://<your-domino-url>/<userID>/<projectID>/r/notebookSession/<runID>/item/foo
You can also view the Swagger UI for your FastAPI app at:
http://<your-domino-url>/<userID>/<projectID>/r/notebookSession/<runID>/docs
You’re all set.