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()
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: