-
-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
apiThis has to do with the Python API (view)This has to do with the Python API (view)featureNew featureNew featuregood first issueAn issue that isn't necessarily easy to implement, but not required to be an expert in view.pyAn issue that isn't necessarily easy to implement, but not required to be an expert in view.py
Milestone
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
Metadata
Metadata
Assignees
Labels
apiThis has to do with the Python API (view)This has to do with the Python API (view)featureNew featureNew featuregood first issueAn issue that isn't necessarily easy to implement, but not required to be an expert in view.pyAn issue that isn't necessarily easy to implement, but not required to be an expert in view.py