Skip to content

Can NiceGUI integrate directly with Starlette? #4381

Closed Answered by falkoschindler
EntangledLabs asked this question in Q&A
Discussion options

You must be logged in to vote

Good question, @EntangledLabs!

It seems to work nicely:

from starlette.applications import Starlette
from starlette.responses import JSONResponse
from starlette.routing import Route
from nicegui import ui

async def homepage(request):
    return JSONResponse({'hello': 'world'})

app = Starlette(debug=True, routes=[Route("/", endpoint=homepage)])

@ui.page("/ui")
def ui_page():
    ui.label("Hello world")

ui.run_with(app)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@EntangledLabs
Comment options

Answer selected by EntangledLabs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants