Open jcheng5 opened 1 year ago
Related to this, can we provide a name to the ~app~ route mounted at the root /
?
I have a pyshiny app that I've added some extra routes to for oauth. From my callback route, I'd like to be able to do something like this request.url_for('shiny:index')
to return back to the shiny app root from my auth callback.
routes = [
Route('/{client_id}/login', login, name="login"),
Route('/{client_id}/callback', callback, name="callback"),
Mount('/', app=app_shiny, name="shiny"),
]
middleware = [
Middleware(SessionMiddleware, secret_key=secrets.token_urlsafe(32))
]
app = Starlette(routes=routes, middleware=middleware)
If a Mount includes a name, then submounts should use a
{prefix}:{name}
style for reverse URL lookups. https://www.starlette.io/routing/#reverse-url-lookups
Hey @jcheng5 , the multipage app feature is really important in my opinion.
It would allow Shiny to be employed by a broader range of developers and to be a true contender for Plotly Dash
.
There is this workaround explained by Appsilon, however it would good to have a reliable native and tested structure to accomplish that.
Congratulations for the great work so far.
Starlette routes provides one way to have multi-page apps. Another way would be to have a true SPA but have the developer experience of a multi-page app (including the URL updating as you navigate between "pages"). (Maybe each sub-app would need to be implemented as a Shiny module)