On Air should support sub-apps created with NiceGUI's APIRouter #2792
xinetzone
started this conversation in
Ideas / Feature Requests
Replies: 2 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.
5 replies
-
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.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
see : main.py
ERROR:
Work:
Beta Was this translation helpful? Give feedback.
All reactions