r/FastAPI • • Dec 13 '22

Question Dockerfile for FastAPI app without security vulnerabilities?

6 Upvotes

I've been happily building a personal CMS using FastAPI for about two months. Developing and deploying Docker with containers, this has been a learning project for both FastAPI and Docker based development. I updated my Docker Desktop version yesterday. This latest version has auto security vulnerability scanning.

Since updating, I've been down a rabbit hole trying to build a new container for my FastAPI application without security vulnerabilities. I'd been using python:3.9.4-alpine as my base image; the new Docker Desktop reports my final build app container has 42 security vulnerabilities.

Web research also indicates using alpine base images for FastAPI applications is not recommended. So I've tried creating base images using the python:3.9 official image, as well as the slim and slim-buster variants, but final built app containers using those base images have hundreds (400+) vulnerabilities.

So, I'm asking if the community maintains such an essential item as a recommended Dockerfile with minimal security vulnerabilities, or if any kind soul would be willing to share their best efforts?

My app's requirements.txt is nothing special, just using what ought to be considered a standard FastAPI + SQLAlchemy + postgresql lib set. Jinja2 for templates, uvicorn & gunicorn, FastAPI-mail... The mini-CMS I'm making is just a blog, using the TinyMCE editor for blog editing. Zero fancy bits.

My project is public here: https://github.com/bsenftner/fastAPI_TDD_Docker

Current Dockerfile generating 42 vulnerabilities: https://github.com/bsenftner/fastAPI_TDD_Docker/blob/main/src/Dockerfile

The requirements.txt needs to be cleaned up: https://github.com/bsenftner/fastAPI_TDD_Docker/blob/main/src/requirements.txt

Any suggestions, advice, or links to examples where a Dockerfile is building a container for a FastAPI app with 0/minimal security vulnerabilities would really help me learn.


r/FastAPI • • Mar 31 '25

Question What's your thoughts on fastapi-users?

19 Upvotes

r/FastAPI • • Jul 12 '26

feedback request Building a "batteries-included" FastAPI starter (auth, billing, admin, email) — what would you want in it?

19 Upvotes

Working on a FastAPI + Next.js SaaS boilerplate (Python equivalent of the JS "ship fast" starters). Backend is FastAPI + Pydantic v2, Firestore for storage so far.

Before I finalize the feature list, curious what this community actually wants baked in:

  • Auth: what's your default — Supabase, Clerk, roll-your-own JWT?

  • Billing: Stripe is obvious, but subscriptions vs. usage-based matters a lot for setup

  • Background jobs: Celery, arq, or just Cloud Tasks/Cloud Run?

Landing page + waitlist if you want to follow progress: https://fastforge.pionetix.com — but honestly more interested in the discussion here than the sign-ups.


r/FastAPI • • Sep 01 '24

Question Backend Dev Needs the Quickest & Easiest Frontend Tool! Any Ideas?

28 Upvotes

Hey, I’m a backend developer using Python (FastAPI) and need a fast, easy-to-learn tool to create a frontend for my API. Ideally, something AI-driven or drag-and-drop would be awesome.

Looking to build simple frontends with a login, dashboard, and basic stats. What would you recommend?


r/FastAPI • • Jan 31 '26

Other Small complexity comparison Django vs. FastAPI

Thumbnail
gallery
35 Upvotes

Explanation

This visualizations work by assigning every file a dot.

  • Green = Low Complexity

  • Red = High Complexity

Complexity is defined as Cyclomatic complexity (McCabe).

The first image is Fast APIs dependency graph.

Very structured and modularized. Very few Complex files and lower rates of connection between files. Most of the files are tests and tutorials.

The second image shows Djangos graph:

Much more interconnected and less modularized. More high complexity files but again most of the codebase is related to testing.

Hope you found the comparison as interesting as I did!


r/FastAPI • • Dec 30 '25

Question FastAPI + Pydantic V2: Is anyone else using it to build AI microservices?

52 Upvotes

Hey r/FastAPI community!

I’ve been diving deep into FastAPI lately, especially with Pydantic V2 and its shiny new features (like computed fields and strict validation). With the AI/LLM boom happening right now, I’ve started building async microservices for AI pipelines things like prompt chaining, RAG systems, and real-time inference endpoints.What I’ve noticed: FastAPI’s native async support + Pydantic V2’s performance feels perfect for handling streaming responses from models likeOpenAI, Llama, etc. Dependency injection makes it super clean to manage API keys, model clients, and context caching. But… I’m curious how others are structuring their projects.

Questions for you all:

  1. Are you using FastAPI for AI/ML services? If yes, what does your stack look like?

  2. Any cool tips for integrating with message queues e.g., Celery, RabbitMQ, Kafka for async task handling?

  3. What’s your take on scaling WebSockets in FastAPI for real-time AI responses?


r/FastAPI • • Apr 13 '26

Other FastAPI gives you the spec. UIGen gives you the full React Frontend. Zero code.

52 Upvotes

Hey everyone,

I’m a huge fan of FastAPI. The fact that it generates an OpenAPI spec out of the box is its true superpower. But I noticed that while we get amazing documentation (Swagger UI / ReDoc) for free, we still have to manually build the internal tools, dashboards, and admin panels to actually use the data easily.

So I built the other half of the equation.

UIGen - point it at your FastAPI /openapi.json URL, and get a fully interactive React frontend in seconds.

npx @uigen-dev/cli serve http://127.0.0.1:8000/openapi.json

# UI is live at http://localhost:4400

How it fits the FastAPI ecosystem

FastAPI is all about types and specs. UIGen follows that philosophy:

  1. Pydantic Validation: Because your spec includes the constraints from your Pydantic models, UIGen automatically builds Zod validation on the frontend to match.

  2. Interactive, not just Docs: Swagger UI is for testing endpoints. UIGen is for managing resources. It handles the "ListView -> DetailView -> EditForm" flow as a cohesive app.

What it generates (from your FastAPI code)

  • Sidebar nav mapped to your API tags/resources.

  • Smart Tables with sorting, pagination, and filtering (derived from your query params).

  • Dynamic Forms derived from your Pydantic models.

  • Detail Views with related resource links.

  • Auth UI - handles Bearer tokens and credential injection via a built-in proxy.

  • Wizards: Large models are automatically split into multi-step forms.

  • Complex Actions: Non-CRUD endpoints show up as custom action buttons.

How it works

It parses your /openapi.json into a custom Intermediate Representation (IR). A pre-built React SPA (shadcn/ui + TanStack) reads that IR and renders the UI. A Vite dev server serves the app and proxies API calls to your FastAPI backend, handling CORS headers so you don't have to fiddle with middleware during dev.

Honest Limitations

  • Circular Models: If you have deeply nested recursive Pydantic models, resolution might skip the deepest levels.

  • Edit View: Works best if you have a standard GET /{id} endpoint for your items.

  • And many other edge cases.

Try it now

If you have a FastAPI app running locally:

npx @uigen-dev/cli serve http://localhost:8000/openapi.json

Or try it on one of the example yaml files in the repo

Would love to hear thoughts from the FastApi community. Of course, this isn't meant to replace a custom consumer-facing frontend, but for internal tools, rapid prototyping, or providing a UI for your API consumers, it’s a massive time-saver.

Happy coding!


r/FastAPI • • May 05 '25

Question FastAPI Cloud is coming!

Thumbnail fastapicloud.com
90 Upvotes

What do you guys think?

I believe it’s a very exciting addition to the FastAPI community backed by one of the biggest venture capitals and created by Tiangolo!

Amazing news!


r/FastAPI • • Sep 26 '26

Other Interactive Map of FastAPIs Github Repository

Thumbnail
creview.io
13 Upvotes

r/FastAPI • • Mar 30 '26

feedback request Define your model → get a full SaaS app instantly (FastAPI + React)

13 Upvotes

I've been working on FastForge, an open-source framework for FastAPI + React.

The idea: you define a SQLAlchemy model, run one command, and get schemas, repository, service, router, and permissions generated.

Change the model, regenerate — schemas update but your custom business logic is preserved.

What you get out of the box:

- JWT auth with token refresh (18 endpoints)

- Role-based permissions (@require_permission decorator)

- Audit logging, soft delete, pagination, search

- Auto-generated TypeScript client from OpenAPI

- React Query hooks, AuthProvider, permission guards

- Multi-tenancy, background jobs, domain events

The workflow:

fastforge init myapp

fastforge crud product # creates model stub

# edit the model

fastforge generate product # generates schema, service, router

uv run uvicorn app.main:app --reload

GitHub: https://github.com/Datacrata/fastforge

Would love feedback on the architecture and what features

you'd want to see next.

​


r/FastAPI • • Apr 14 '26

feedback request I did a thing: FastPKI - A proper REST API for PKI management (Easy-RSA alternative)

13 Upvotes

I got tired of Easy-RSA and built FastPKI: a fully async, API-driven PKI management system on top of FastAPI + SQLModel

GitHub: https://github.com/jsenecal/fastpki Docs: https://jsenecal.github.io/fastpki/

What it does:

  • Create and manage Certificate Authorities with intermediate CA hierarchies and path length constraints

  • Issue and revoke server, client, and CA certificates via a clean RESTful API

  • Multi-tenant via organizations, with RBAC (SUPERUSER / ADMIN / USER) and per-user capability flags for fine-grained cert operations

  • SQLite for dev, PostgreSQL + asyncpg for prod

  • Alembic migrations, Docker + Compose support, pre-built GHCR image

Stack:

  • FastAPI + SQLModel (async throughout with aiosqlite/asyncpg)

  • Pydantic v2, Alembic, cryptography lib

  • uv for packaging, ruff for linting/formatting, mypy for type checking

  • 279 tests, ~90% coverage

Built with Claude Code, but not totally vibecoded - every design decision was intentional and it's battle-tested in a real production telecom environment. The permission model, CA hierarchy constraints, and async DB layer were all deliberate choices.

Currently at v0.3.5. Feedback and PRs welcome.


r/FastAPI • • Nov 12 '25

Other Sitio para probar APIs gratuito

Thumbnail reddit.com
0 Upvotes

r/FastAPI • • Feb 08 '26

Tutorial How FastAPI test client works

Thumbnail reddit.com
0 Upvotes

r/FastAPI • • May 27 '25

Question JSON Schema Generation For Generics

1 Upvotes

This is really a pydantic issue but this subreddit is fairly active.

I’m trying to simplify managing some schemas but I keep getting the wrong definition name in the OpenApi schema that is generated.

Example:

from typing import Annotated, Generic, Literal, TypeVar
from pydantic import BaseModel

T = TypeVar(str, “T”)
V = TypeVar(int | list[int], “V”)

One = Literal[“one”]
Two = Literal[“two”]
A = Literal[100]
B = Literal[200, 201, 202]

class SchemaBase(BaseModel, Generic[T, V]):
    x: T
    y: V

OptionOne = Annotated[SchemaBase[One, A], “OptionOne”]
Option two = Annotated[SchemaBase[Two, B], “OptionTwo”]


class RequestBody(BaseModel):
    option: OptionOne | OptionTwo

My definitions then end up the names “SchemaBase[Literal[“One”], Literal[100]]” “SchemaBase[Literal[“Two”], Literal[200, 201, 202]]”

However, I’d like the definition titles to be “OptionOne” and “OptionTwo”.

What am I overlooking?

Also, why is the way I’m approaching this wrong?


r/FastAPI • • Apr 04 '26

pip package FastAPI Views - yet another class based views library

0 Upvotes

I've been working on fastapi-views, a library that brings Django REST Framework-style class-based views to FastAPI while keeping full type safety and dependency injection.

The core idea: instead of wiring up individual route functions, you inherit from a view class and the library registers routes, status codes, and OpenAPI docs automatically — with correct HTTP semantics out of the box.

It also ships with DRF-style filters, RFC 9457 Problem Details for error responses (with ready-to-use exception classes), and optional Prometheus metrics and OpenTelemetry tracing.

It's not supposed to be a "batteries-included" / "all-in-one" framework like DRF — the package is not tied to any specific database/ORM, auth framework, or pattern. That said, I'm considering implementing an auth layer and permission classes, as well as some optional SQLAlchemy integration.

- Docs: https://asynq-io.github.io/fastapi-views/

- Source: https://github.com/asynq-io/fastapi-views

- Install: `pip install fastapi-views`

I've been using it with success for a while now, so I thought I'd share it here. If you've been building APIs with FastAPI and found yourself copy-pasting the same patterns across projects, this might be worth a look. Happy to hear what features you'd find most valuable, what's missing, or your thoughts on the project in general. If you like it, leaving a star would be appreciated.


r/FastAPI • • May 22 '23

Question Using FastApi with AWS Lambda and API Gateway Stages?

1 Upvotes

I've deployed my fastapi app to aws lambda using the api gateway. I want to try and use the api gateway stages with the lambda aliases but I'm having an issue where I have to set the root path inside the fastapi code to the name of the stage or else I get all sorts of errors. The docs page gives a 403 and other endpoints give a missing authentication error. So if I have a stage named 'prod' I have to set root_path="/prod/" and if its 'staging' I have to use root_path="/staging/". This kind of ruins the whole point of using staging as I can't be changing the codebase in-between deployments. Has anyone here successfully deployed this way before and found a way to utilize the api gateways stages effectively? Thanks.


r/FastAPI • • May 20 '22

Question How to pass both file (uploaded) and dict params to POST request in FAST API?

1 Upvotes

Specifically, I want the example below to work:

from fastapi import FastAPI
from fastapi import UploadFile

app = FastAPI()

@app.post("/check")
def foo(grid: dict, file: UploadFile):
    return {"len_grid": len(grid), "filename": file.filename}

Currently, while trying to create a POST request passing any valid dict to grid parameter and upload some file, FAST API raises the error:

"detail": [
    {
      "loc": [
        "body",
        "grid"
      ],
      "msg": "value is not a valid dict",
      "type": "type_error.dict"
    }
  ]
}

At the same time, if I use only one of these parameters inside the function, it works well.


r/FastAPI • • Jan 15 '23

Question 422 http error

0 Upvotes

Hi guys, i use angular for my front end. But when i do a login request it is returning 422 http response. What do you think might be the problem? Any answer will be highly appreciated. Thanks !


r/FastAPI • • Oct 11 '23

Question Is * in the path acceptable ?

1 Upvotes

Probably this is not a FastAPI strictly related question, but actually this is the framework I’m using.

I’m wondering if the usage of the wildcard in the path is acceptable. I’m writing an API that, among other things, allows users to crud projects and roles related to them. GET path to retrieve the list of roles related to a specific project will be:

/projects/{project_id}/roles

But I would like also to give the users the ability to get a list of roles of all the projects in one shot, so my thought was to provide an additional path like the following:

/projects/*/roles

Is this something already seen? Is it common?


r/FastAPI • • Apr 27 '23

Question How to add methods dynamically to an instance of SQLModel class?

1 Upvotes

I am using sqlmodel as ORM in my fastapi application, based on one of the request parameters, I am supposed to be adding functionality to conversion data from one format to another, usually a couple of transformations, in my case timeseries data, based on the ```value``` type of the ```Element``` object, here, I am abstracting all that and just trying to print the type of conversion, I'd like to modify the ```Element``` class such that methods could be added dynamically based on the ```value``` type of an ```Element``` instance during the object instanciation. assuming all conversions are possible except to itself, I created a functions mapper dictionary to index search the respective function and add it using the ```setattr``` method, instead of using a mapper for functions, it seemed better to directly set the functions using ```types.MethodType(locals()[f"{self.value_type}_{conversion_method}"], self)```, in both cases, the code raises no errors but also doesn't add the methods as I wanted to, wondering where am I going wrong here.

    from uuid import UUID, uuid4
    from sqlmodel import Field, SQLModel
    
    
    def a_to_b_function():
        print("A to B")
    
    
    def a_to_c_function():
        print("A to C")
    
    
    def b_to_a_function():
        print("B to A")
    
    
    def b_to_c_function():
        print("B to C")
    
    
    def c_to_a_function():
        print("C to A")
    
    
    def c_to_b_function():
        print("C to B")
    
    
    VALUE_TYPE_CONVERSION_MAPPER = {
        "A_to_B": a_to_b_function,
        "A_to_C": a_to_c_function,
        "B_to_A": b_to_a_function,
        "B_to_C": b_to_c_function,
        "C_to_A": c_to_a_function,
        "C_to_B": c_to_b_function,
    }
    
    
    class AllBase(SQLModel):
        id: UUID = Field(default_factory=uuid4, primary_key=True)
    
    
    class Element(AllBase, table=True):
        """
        interacts with elements table
        """
    
    
        value_type: str = Field(default=None)  # A, B, C - possible values
    
        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)
            all_types = [
                "A",
                "B",
                "C",
            ]
            for value_type in all_types:
                if value_type != self.value_type:
                    conversion_method = f"to_{value_type}"
                    setattr(
                        self,
                        conversion_method,
                        VALUE_TYPE_CONVERSION_MAPPER[
                            f"{self.value_type}_{conversion_method}"
                        ]
                        # types.MethodType(locals()[f"{self.value_type}_{conversion_method}"], self),
                    )

r/FastAPI • • Nov 06 '23

Question Can someone explain why using .get(id) doesn't work when deleting an item but .filter(models.Post.id == id) does?

1 Upvotes

If I get a single post using the line below it works.

    post = db.query(models.Post).get(id)

However, if i use the line above, followed by with an if statement between the code above and the code below I get the AttributeError.

    post.delete(synchronize_session=False)
    db.commit()

AttributeError: 'Post' object has no attribute 'delete'

GetPost and DeletePost code snippet

@app.get("/posts/{id}")
def get_post(id: int, db: Session = Depends(get_db)):
    # cursor.execute("""SELECT * FROM posts WHERE id = %s """, (str(id),))
    # post = cursor.fetchone()

    post = db.query(models.Post).get(id)

    if not post:
        raise HTTPException(
            status_code=status.HTTP_404_NOT_FOUND, detail=f"Post: '{id}' was not found"
        )
    return {"post_detail": post}


@app.delete("/posts/{id}", status_code=status.HTTP_204_NO_CONTENT)
def delete_post(id: int, db: Session = Depends(get_db)):
    # cursor.execute("""DELETE FROM posts WHERE id = %s returning * """, (str(id),))
    # deleted_post = cursor.fetchone()
    # conn.commit()
    post = db.query(models.Post).filter(models.Post.id == id)

    if post == None:
        raise HTTPException(
            status_code=status.HTTP_404_NOT_FOUND,
            detail=f"Post: '{id}' does not exist",
        )
    post.delete(synchronize_session=False)
    db.commit()
    return Response(status_code=status.HTTP_204_NO_CONTENT)

r/FastAPI • • Jun 18 '23

feedback request [Noob] Redis - FastAPI Integration Works but Some Test Fail (RuntimeError: Event loop is closed)

1 Upvotes

This is my first time writing backend - please assist if you can spare a minute.

Below is an example of my tests. This test does not fail but others do despite them being very similar. Would anyone be able to advise if I integrating Redis properly? I am using it to store tokens, nothing else. But I'm not sure if the connection pool is being properly ran.

Note: I skipped writing the imports in most cases to limit amount of code to view. At the bottom are my tests and the fail ones. I can post the failing endpoints but nothing crazy is happening there - get_redis function is used similarly to the endpoint below (logout).

main.py:

from fastapi import FastAPI
from backend.app.api.v1.endpoints import users
from backend.app.core.database import create_database_connection
from backend.app.core.redis import create_redis_connection

app = FastAPI()

app.include_router(users.router, prefix="/users")

@app.on_event("startup")
async def startup_event():
    app.state.client, app.state.db = create_database_connection()
    app.state.redis_pool = await create_redis_connection()

@app.on_event("shutdown")
async def shutdown_event():
    app.state.client.close()
    await app.state.redis_pool.close()

redis.py:

import aioredis
from fastapi import Request
from backend.app.core.config import settings

async def create_redis_connection():
    redis_pool = await aioredis.from_url(settings.redis_url)
    return redis_pool

async def get_redis(r: Request):
    return r.app.state.redis_pool

users.py:

router = APIRouter()

@router.post("/logout")
async def logout(
    access_token: str = Depends(oauth2_scheme),
    refresh_token: str = Body(..., embed=True),
    redis_pool=Depends(get_redis)
):
    # Delete access token from Redis pool
    deleted_access_token = await redis_pool.delete(access_token)
    # Delete refresh token from Redis pool
    deleted_refresh_token = await redis_pool.delete(refresh_token)

    # If neither token was found in the Redis pool, raise an exception
    if not deleted_access_token and not deleted_refresh_token:
        raise HTTPException(status_code=401, detail="Invalid access or refresh token")

    return {"detail": "Successfully logged out"}

test_users.py:

@pytest.fixture 
def anyio_backend() -> str: # disable trio
    return "asyncio"

@pytest.fixture
async def app_with_db():
    await app.router.startup()
    yield
    await app.router.shutdown()

@pytest.fixture 
async def test_user(app_with_db): # create/manage test user
    async with AsyncClient(app=app, base_url="http://test") as ac:
        # Use the current time to ensure uniqueness, convert it to bytes and hash it using SHA-1
        unique_hash = hashlib.sha1(str(time.time()).encode()).hexdigest() # used for test email

        # Prepare the test user data
        new_user = {
            "email": f"pytestuser-{unique_hash[:20]}@example.com",
            "password": "Test@1234",
            "confirm_password": "Test@1234"
        }

        # Send a POST request to the /users/register endpoint
        response = await ac.post("/users/register", json=new_user)
        assert response.status_code == 200

        # Find user ID by EMAIL
        db = app.state.db
        user_in_db = await db.users.find_one({"email": new_user["email"]})

        # Assert that the user was found and the email matches
        assert user_in_db is not None
        assert user_in_db["email"] == new_user["email"]

        # Define test user login dict
        test_user_credentials = {
            "username" : user_in_db["email"], # OAuth expects "username", not "email"
            "password" : new_user["password"]
        }

        yield test_user_credentials

        # Clean DB from test data
        await db.users.delete_one({"_id": ObjectId(user_in_db["_id"])})

@pytest.mark.anyio
async def test_login_and_logout(app_with_db, test_user):
    async with AsyncClient(app=app, base_url="http://test") as ac:

        # Send a POST request to the /token endpoint
        response = await ac.post("/users/token", data=test_user)

        # Assert that the response status code is 200
        assert response.status_code == 200

        # Assert the returned token data
        token_data = response.json()
        assert "access_token" in token_data
        assert "refresh_token" in token_data
        assert token_data["token_type"] == "bearer"

        # Logout
        response = await ac.post("/users/logout", headers={"Authorization": f"Bearer {token_data['access_token']}"}, json={"refresh_token": token_data['refresh_token']})
        assert response.status_code == 200
        detail = response.json()
        assert detail["detail"] == "Successfully logged out"

ERRORS:

backend/tests/api/v1/test_users.py::test_register PASSED
backend/tests/api/v1/test_users.py::test_login_and_logout PASSED
backend/tests/api/v1/test_users.py::test_refresh_token ERROR
backend/tests/api/v1/test_users.py::test_register_existing_email PASSED
backend/tests/api/v1/test_users.py::test_login_incorrect_password PASSED
backend/tests/api/v1/test_users.py::test_login_nonexistent_email PASSED
backend/tests/api/v1/test_users.py::test_refresh_token_invalid PASSED
backend/tests/api/v1/test_users.py::test_logout_invalid_token FAILED
backend/tests/api/v1/test_users.py::test_register_invalid_data FAILED
backend/tests/api/v1/test_users.py::test_register_mismatch_data PASSED
====================================================== ERRORS ======================================================
_______________________________________ ERROR at setup of test_refresh_token _______________________________________

anyio_backend = 'asyncio', args = (), kwargs = {'app_with_db': None}, backend_name = 'asyncio', backend_options = {}
runner = <anyio._backends._asyncio.TestRunner object at 0x7f17708ded70>

    def wrapper(*args, anyio_backend, **kwargs):  # type: ignore[no-untyped-def]
        backend_name, backend_options = extract_backend_and_options(anyio_backend)
        if has_backend_arg:
            kwargs["anyio_backend"] = anyio_backend
    
        with get_runner(backend_name, backend_options) as runner:
            if isasyncgenfunction(func):
>               yield from runner.run_asyncgen_fixture(func, kwargs)

../../../.local/share/virtualenvs/NG_Web--8SMFfFz/lib/python3.10/site-packages/anyio/pytest_plugin.py:68:

[...]

============================================= short test summary info ==============================================
FAILED backend/tests/api/v1/test_users.py::test_logout_invalid_token - RuntimeError: Event loop is closed
FAILED backend/tests/api/v1/test_users.py::test_register_invalid_data - RuntimeError: Event loop is closed
ERROR backend/tests/api/v1/test_users.py::test_refresh_token - RuntimeError: Event loop is closed
======================================= 2 failed, 7 passed, 1 error in 2.32s =======================================
                                                       

r/FastAPI • • Jan 05 '23

Question Does API Router have an `on_mounted` callback?

0 Upvotes

Here is what I would like to do:

Router has directories it needs to mount local to that router. When the router is online, it needs to fetch a reference to the main app to mount a directory (since routers do not support file mounting)

Thoughts?


r/FastAPI • • Nov 07 '23

Question Best way to test functions ?

1 Upvotes

Hello everybody, currently I'm working on a project that uses fastApi, and I want to know how can i test a function without making it into an endpoint, is there is a fast quick way to do this ?