You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We could do the following 3 items to further reduce boilerplate in controllers.
However, while boilerplate is reduced, all 3 of these actions also hide behavior which we may not want to hide.
Remove action_fallback CodeCorpsWeb.FallbackController from all controllers and instead move it into the CodeCorpsWeb module into the def controllerquote block
This makes sense at first glance, but it does also put all of our controllers into basically the same basket, regardless of them being actual API controllers, or just webhook handlers, or something else entirely.
Unfortunately, it is not currently possible to specify multiple action fallbacks for the same controller, which would be an argument for doing this, since it would allow simultaneously specifying global and group-specific fallbacks.
Remove plug CodeCorpsWeb.Plug.DataToAttributes from all controllers and move it into router.ex into the :api pipeline.
We would have to separate our general api pipeline and the part of the pipeline that handles github and sprite webhooks, since we don't want this plug in that part, but it would make sense to do so anyway, since they are, in fact, different parts of the "interface".
Remove plug CodeCorpsWeb.Plug.IdsToIntegers from all controllers and move it into router.ex into the :api pipeline.
Basically same argument as above.
Really, these two plugs should be considered one pipeline, since their intention is to prepare and make sense of the data sent by our client.
joshsmith
changed the title
Discussion: Further reduction of controller boilerplate (Phase 2 of removing ja_resource)
RFC: Further reduction of controller boilerplate (Phase 2 of removing ja_resource)
Jan 1, 2018
We could do the following 3 items to further reduce boilerplate in controllers.
However, while boilerplate is reduced, all 3 of these actions also hide behavior which we may not want to hide.
Remove
action_fallback CodeCorpsWeb.FallbackController
from all controllers and instead move it into theCodeCorpsWeb
module into thedef controller
quote
blockThis makes sense at first glance, but it does also put all of our controllers into basically the same basket, regardless of them being actual API controllers, or just webhook handlers, or something else entirely.
Unfortunately, it is not currently possible to specify multiple action fallbacks for the same controller, which would be an argument for doing this, since it would allow simultaneously specifying global and group-specific fallbacks.
Remove
plug CodeCorpsWeb.Plug.DataToAttributes
from all controllers and move it intorouter.ex
into the:api
pipeline.We would have to separate our general api pipeline and the part of the pipeline that handles github and sprite webhooks, since we don't want this plug in that part, but it would make sense to do so anyway, since they are, in fact, different parts of the "interface".
Remove
plug CodeCorpsWeb.Plug.IdsToIntegers
from all controllers and move it intorouter.ex
into the:api
pipeline.Basically same argument as above.
Really, these two plugs should be considered one pipeline, since their intention is to prepare and make sense of the data sent by our client.
@joshsmith
What do you think? Overall, this would not take much time, maybe an hour, but I'm not really sure if it would help or hurt us.
The text was updated successfully, but these errors were encountered: