Add JSON API for artifacts and docker tag search#272
Conversation
Accepts the same parameters as the LiveViews, but returns a JSON response.
|
Supersedes #236. I plan to use this in phx.gen.release --docker to find the proper docker image. |
| @@ -0,0 +1,83 @@ | |||
| defmodule BobWeb.Plugs.SearchJson do | |||
There was a problem hiding this comment.
I think this would fit better as a phoenix controller.
There was a problem hiding this comment.
The problem with using a controller is that we couldn't mount the LiveView at the router any more. LiveViews rendered from a controller can't use handle_params, so this would make the code more complex, that's why I decided to go for a plug. Or do you mean keeping the plug to dispatch, but calling a controller from the plug?
There was a problem hiding this comment.
I was thinking a /api router scope with dedicated API-only controllers to keep the UI and API separate. Similar to how hexpm works.
There was a problem hiding this comment.
Ah, going the explicit route. Sure, that works!
|
Closing for #273 |
Accepts the same parameters as the LiveViews, but returns a JSON response.