I was thinking if it's possible to map routes directly to methods of Controller. For example:
router.get("/", TodosController().index)
etc
Resources can be implemented by adopting protocols. I.e. TodosController adopts Resource protocol and implements some or all of the protocol's methods. router.resources() will expect a class which adopts that protocol.
Filtering can be implemented by looking up method names via reflection.
What do you think of this approach?
I was thinking if it's possible to map routes directly to methods of Controller. For example:
Resources can be implemented by adopting protocols. I.e. TodosController adopts Resource protocol and implements some or all of the protocol's methods. router.resources() will expect a class which adopts that protocol.
Filtering can be implemented by looking up method names via reflection.
What do you think of this approach?