Skip to content

Commit

Permalink
register middlewares in ui.run_with
Browse files Browse the repository at this point in the history
  • Loading branch information
rodja committed Jan 11, 2025
1 parent b023b1d commit 20c4f6e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nicegui/ui_run_with.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
from typing import Literal, Optional, Union

from fastapi import FastAPI
from fastapi.middleware.gzip import GZipMiddleware

from . import core, storage
from .air import Air
from .language import Language
from .middlewares import RedirectWithPrefixMiddleware
from .nicegui import _shutdown, _startup


Expand Down Expand Up @@ -59,8 +61,9 @@ def run_with(
prod_js=prod_js,
show_welcome_message=show_welcome_message,
)

storage.set_storage_secret(storage_secret)
core.app.add_middleware(GZipMiddleware)
core.app.add_middleware(RedirectWithPrefixMiddleware)

if on_air:
core.air = Air('' if on_air is True else on_air)
Expand Down

0 comments on commit 20c4f6e

Please sign in to comment.