This guide shows you how to embed the ngrok agent into FastAPI applications using the ngrok-python library.
It covers setting up a FastAPI application with ngrok integration for secure ingress.
ngrok-python and FastAPI libraries used in this example are sensitive to versions.
Use of Virtual Environments is highly recommended.
What you’ll need
1. Install dependencies
Create a requirements.txt file with the following dependencies:
Install the dependencies:
2. Create the FastAPI application
Create a main.py file with the following code: