Skip to content

Commit

Permalink
Add fastapi.configure
Browse files Browse the repository at this point in the history
  • Loading branch information
pelletier committed Jan 29, 2024
1 parent 6f062cd commit ba27dd0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/dispatch/fastapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""Integration of Dispatch programmable endpoints for FastAPI.
"""

import fastapi


def configure(app: fastapi.FastAPI):
"""Configure the FastAPI app to use Dispatch programmable endpoints."""
...
5 changes: 4 additions & 1 deletion tests/test_fastapi.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import unittest
import dispatch
import dispatch.fastapi
import fastapi
from fastapi.testclient import TestClient


class TestFastapi(unittest.TestCase):
class TestFastAPI(unittest.TestCase):
def test_fastapi(self):
app = fastapi.FastAPI()

dispatch.fastapi.configure(app)

@app.get("/")
def read_root():
return {"Hello": "World"}
Expand Down

0 comments on commit ba27dd0

Please sign in to comment.