index.community/backend/lib/backend_web/controllers/search_controller.ex
2019-07-23 12:20:34 +00:00

14 lines
416 B
Elixir

defmodule BackendWeb.SearchController do
use BackendWeb, :controller
alias Backend.Api
action_fallback(BackendWeb.FallbackController)
def index(conn, params) do
query = Map.get(params, "query")
cursor_after = Map.get(params, "after", nil)
%{instances: instances, next: next} = Api.search_instances(query, cursor_after)
render(conn, "index.json", instances: instances, next: next)
end
end