It does not look like the code in the blog You are following… which looks like this
def create(conn, %{"business" => business_params}) do
with {:ok, %Business{} = business} <- Directory.create_business(business_params) do
conn
|> put_status(:created)
|> put_resp_header("location", business_path(conn, :show, business))
|> render("show.json", business: business)
end
end
Anyway, I would not recommend to follow this (old) post because things have changed since.
Maybe try this one, which cover Phoenix 1.5
https://lobotuerto.com/blog/building-a-json-api-in-elixir-with-phoenix/
BTW You are using user variable, which was never defined, and You define user_params, which is never used.






















