how to use ssl certificate #387
-
Hello, how to run nicegui with ssl (certificate,key) ? uvicorn.run(app, host="0.0.0.0", port=8000, ssl_keyfile="./key.pem", ssl_certfile="./cert.pem") is it possible to do the same thing with 'ui.run()' ? thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
so I tried to run nicegui by using uvicorn.run() instead of ui.run() but I had a lot of errors. I think the problem is the app parameter. any idea how to do that ? |
Beta Was this translation helpful? Give feedback.
-
You can adapt the FastAPI example to start the server yourself: import uvicorn
from fastapi import FastAPI
from nicegui import ui
# you need to create the FastAPI app yourself
app = FastAPI()
# normal NiceGUI code
ui.label('Hello!')
# replace ui.run with ui.run_with to connect NiceGUI with the app
ui.run_with(app)
# start uvicorn with the app
uvicorn.run(app, host='0.0.0.0', port=8000) Nevertheless, we should think about adding SSL parameters (or |
Beta Was this translation helpful? Give feedback.
You can adapt the FastAPI example to start the server yourself:
Nevertheless, we should think about adding SSL parameters (or
**kwargs
) toui.run
.