sematic icon indicating copy to clipboard operation
sematic copied to clipboard

Refactor and centralize Flask response handling

Open tscurtu opened this issue 1 year ago • 0 comments

Refactoring ideas:

  1. JSON conversion (including calling to_json_encodeable() and flask.jsonify()) can be done in a after_request hook. This way we have a dedicated place to convert JSONEncodableMixin universally. Also in the future, we can add logic in reacting to different requested "content-type" (eg. xml) in a centralized way. This API endpoint function only needs to focus on business logic.

  2. Together with the above, we should consider adopting Blueprint to divide business domains and scope hooks usage.

tscurtu avatar Jun 22 '23 10:06 tscurtu