The Batteries-Detachable Web Framework|
$
pip install -U
view.py
Use view.py as a micro web framework
from view import new_app
app = new_app()
@app.get("/")
@app.query("greeting", str, default="Hello")
def index(greeting: str):
return f"{greeting}, view.py!"
app.run()
...Or as fullstack
# routes/index.py
from view import get, query, template
@get()
@query("greeting", str, default="Hello")
async def index(greeting: str):
# greeting is automatically accessible via the template
return await template("index")
# Filesystem Based Routing