On Air should support sub-apps created with NiceGUI's APIRouter #2792
Replies: 3 comments 5 replies
-
It's working fine for me with this example: from fastapi import FastAPI
from nicegui import ui
app = FastAPI()
@app.get('/api')
def read_root():
return {'Hello': 'World'}
@ui.page('/')
def show():
ui.label('Hello, FastAPI!')
ui.button('click me', on_click=lambda: ui.notify('clicked'))
ui.link('subpage', '/subpage')
@ui.page('/subpage')
def subpage():
ui.label('Hello, subpage!')
ui.run_with(app,on_air=True) Did you enter the url https://asia.on-air.io/test by yourself? Or how did you end up with that? There should always be a path like |
Beta Was this translation helpful? Give feedback.
-
Oh wow. I think we totally miss On Air support for APIRouter. Here a minimal reproduction: from nicegui import APIRouter, app, ui
router = APIRouter(prefix='/router')
app.include_router(router)
ui.link('go to router', '/router')
ui.link('go to subpage', '/subpage')
@router.page('/')
def router_page():
ui.label('Hello from APIRouter!')
@ui.page('/subpage')
def subpage():
ui.label('Hello from subpage!')
ui.run(on_air=True) Opening subpage works, but via APIRouter not. This is correctly marked as a feature request. I'll just update the title accordingly. |
Beta Was this translation helpful? Give feedback.
-
The issue seems to be related to Kludex/starlette#869 and Kludex/starlette#2514. When accessing |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
see : main.py
ERROR:
Work:
Beta Was this translation helpful? Give feedback.
All reactions