iri
iri copied to clipboard
Api command functional routing
- Use runtime exceptions and handle it all in the same place Improve readability/maintainability. Ease create proper http responses.
- Refactor how to validate and get an uri from strings
- Request body errors as bad request responses
- Use functional hash mapping for command routing instead of switch cases Improve readability/maintainability/efficiency of the code.
Thank you @gubatron for the review. I hope something can be use.
I was considering using jax-rs. However, since your solution may also be satisfactory it may be accepted when we come around to refactor the API.
I'm coming from https://github.com/iotaledger/iri/pull/743, where the command pattern was cited.
In that PR the Codacy bot is suggesting to lower the complexity of the method process(...) in the API.
In order to have better structure with less complexity, the logic should be something like it was commited in this issue, more precisely https://github.com/iotaledger/iri/pull/392/commits/53c519991f114ca613e3f03a5545d200d842f9cc
Hey @yovendielmundo,
Will you be willing to do an implementation of the API using JAX-RS with RESTEASY? I liked your use of the commander pattern but I think that for the longer term, using JAX-RS will be better.
If you agree, here is a link to a quick tutorial to get started: https://github.com/vdevigere/undertow-cdi-jaxrs/wiki.
@GalRogozinski What if we implement the basic functionality he committed in https://github.com/iotaledger/iri/commit/53c519991f114ca613e3f03a5545d200d842f9cc so that the current structure becomes more malleable faster and then go on to using that tool?
That makes good sense actually. Go for it.
I'll keep an eye on this PR.
On Sun, May 13, 2018, 8:13 PM Bruno A. dos Santos [email protected] wrote:
@GalRogozinski https://github.com/GalRogozinski What if we implement the basic functionality he committed in 53c5199 https://github.com/iotaledger/iri/commit/53c519991f114ca613e3f03a5545d200d842f9cc so that the current structure becomes more malleable faster and then go on to using that tool?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/iotaledger/iri/pull/392#issuecomment-388641867, or mute the thread https://github.com/notifications/unsubscribe-auth/AHlhl69szdfUYQ1UKJARrnOAw92sHUGCks5tyGnKgaJpZM4Q3j6Q .