-
-
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 feature
Description
Proposal:
To fit with other frameworks, view.py should implement controllers (i.e. routing based on classes). This should be pretty easy, actually. This won't be a new loader strategy, but will act sort of like a router. For example:
from view import new_app, get
app = new_app()
class MyController(Controller):
@get("/")
def get(self):
return "Hello, world!"
# Alternatively, we can implicitly call the router function
class MyOtherController(Controller):
def get(self, test: str): # Automatic input
return "Hello, world!"
app.load(MyController(), MyOtherController())
app.run()Metadata
Metadata
Assignees
Labels
apiThis has to do with the Python API (view)This has to do with the Python API (view)featureNew featureNew feature