init
This commit is contained in:
commit
17d7f9751b
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
# Python-generated files
|
||||
__pycache__/
|
||||
*.py[oc]
|
||||
build/
|
||||
dist/
|
||||
wheels/
|
||||
*.egg-info
|
||||
|
||||
# Virtual environments
|
||||
.venv
|
1
.python-version
Normal file
1
.python-version
Normal file
@ -0,0 +1 @@
|
||||
3.12
|
31
main.py
Normal file
31
main.py
Normal file
@ -0,0 +1,31 @@
|
||||
from fastapi import FastAPI
|
||||
from nicegui import app as nicegui_app, ui
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
@app.get('/')
|
||||
def read_root():
|
||||
return {'Hello': 'World'}
|
||||
|
||||
|
||||
# Register a page with a custom path
|
||||
@ui.page('/show')
|
||||
def show():
|
||||
# Your UI code goes here
|
||||
ui.label('Hello, FastAPI!')
|
||||
# Some bindings
|
||||
ui.dark_mode().bind_value(nicegui_app.storage.user, 'dark_mode')
|
||||
ui.checkbox('dark mode').bind_value(nicegui_app.storage.user, 'dark_mode')
|
||||
|
||||
|
||||
# Integrate with your FastAPI Application
|
||||
ui.run_with(
|
||||
app=app,
|
||||
storage_secret='pick your private secret here',
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
10
pyproject.toml
Normal file
10
pyproject.toml
Normal file
@ -0,0 +1,10 @@
|
||||
[project]
|
||||
name = "nicegui-api-test"
|
||||
version = "0.1.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = [
|
||||
"fastapi[standard]>=0.116.1",
|
||||
"nicegui>=2.21.1",
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user