File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -79,21 +79,19 @@ app = rx.App(api_transformer=fastapi_app)
7979
8080You can also provide a callable that transforms the ASGI app:
8181
82- ``` python
82+ ``` python box
8383import reflex as rx
84- from starlette.middleware import Middleware
8584from starlette.middleware.cors import CORSMiddleware
8685
87- # Create a transformer function
86+ # Create a transformer function that returns a transformed ASGI app
8887def add_cors_middleware (app ):
89- # Add CORS middleware to the app
90- middleware = CORSMiddleware(
88+ # Wrap the app with CORS middleware and return the wrapped app
89+ return CORSMiddleware(
9190 app = app,
9291 allow_origins = [" https://example.com" ],
9392 allow_methods = [" *" ],
9493 allow_headers = [" *" ],
9594 )
96- return middleware
9795
9896# Create a Reflex app with the transformer
9997app = rx.App(api_transformer = add_cors_middleware)
You can’t perform that action at this time.
0 commit comments