Expose a FastAPI App

Expose a local FastAPI application through an Exposr tunnel.

Setup

Create a basic FastAPI application:

main.py
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def read_root():
    return {"message": "Hello from Exposr!"}

Start FastAPI

bash
uvicorn main:app --host 127.0.0.1 --port 3000

Expose it

bash
exposr expose 3000

Access Swagger docs

With the tunnel active, FastAPI's built-in Swagger documentation is accessible at:

text
http://SERVER_IP:25565/docs

The interactive API documentation works through the tunnel just as it does locally.