Jaymon / endpoints

Lightweight REST api backend framework that automatically maps urls to python modules and classes
MIT License
29 stars 10 forks source link

Routing and extending improvements #65

Closed Jaymon closed 7 years ago

Jaymon commented 7 years ago

So I think we should move getting the callback into the Router class, and we should move the actual handling of the Controller to the controller, so Call.handle() and Call.handle_error() would just call Controller.handle() and Controller.handle_error() respectively.

This was the original note I had on it:

add a Controller.handle() method that will handle most everything, call will defer to that method and maybe handle_error will also defer to the Controller.handle_error method

I also think Router should have a _callback_name_cache that will find all the GET, POST, etc. methods in the controller, this way it will only have to inspect the controller once and then it will have it all so subsequent requests won't have to search for the method they want.