Open
Description
Feature description
To support or help people migrate from other libraries, view.py should introduce routers. These should be quite easy to implement, and the loader should take care of most of it.
Feature example API
A very basic implementation would be:
from view import new_app, Router
app = new_app()
router = Router()
@router.get("/")
async def index():
return "hello, view.py"
app.load([router])
app.run()
I think we could go further though, and have some magic involved:
from view import new_app, new_router
app = new_app()
router = new_router(prefix="/hello") # call get_app() internally and assign a router to the app instance
@router.get("/")
async def index():
return "hello, view.py"
# automatically assign routes to app
app.run()
Anything else?
No response