flama
flama copied to clipboard
Allow declarative routing
Modify how Routes and Routers are initialized and how are handling the main application to allow declarative routing for all Routes types.
An example of the goal syntax:
class PuppyResource(BaseResource, metaclass=CRUDResource):
name = "puppy"
model = puppy_model
schema = puppy_schema
routes = [
Route("/", root_mock),
ResourceRoute("/", PuppyResource),
Mount("/foo", routes=[
Route("/", foo_mock, methods=["GET"]),
Route("/view", foo_view_mock, methods=["GET"])
])
]
app = Flama(routes=routes)