flama icon indicating copy to clipboard operation
flama copied to clipboard

Allow declarative routing

Open perdy opened this issue 3 years ago • 0 comments

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)

perdy avatar Jan 24 '22 02:01 perdy