Skip to content

Add JSON API for artifacts and docker tag search#272

Closed
SteffenDE wants to merge 1 commit into
hexpm:mainfrom
SteffenDE:sd-docker-api
Closed

Add JSON API for artifacts and docker tag search#272
SteffenDE wants to merge 1 commit into
hexpm:mainfrom
SteffenDE:sd-docker-api

Conversation

@SteffenDE

Copy link
Copy Markdown
Contributor

Accepts the same parameters as the LiveViews, but returns a JSON response.

Accepts the same parameters as the LiveViews, but returns
a JSON response.
@SteffenDE

Copy link
Copy Markdown
Contributor Author

Supersedes #236. I plan to use this in phx.gen.release --docker to find the proper docker image.

phoenixframework/phoenix#6424
phoenixframework/phoenix#6437

@@ -0,0 +1,83 @@
defmodule BobWeb.Plugs.SearchJson do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would fit better as a phoenix controller.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking a /api router scope with dedicated API-only controllers to keep the UI and API separate. Similar to how hexpm works.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, going the explicit route. Sure, that works!

@ericmj

ericmj commented Jul 1, 2026

Copy link
Copy Markdown
Member

Closing for #273

@ericmj ericmj closed this Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants