问题
I am making a phoenix api for my react frontend and I am sending a post request with an object of objects, and I figured that I need to use options in the api to get them beause with post it just failed, but now the params are empty. Why is that?
What I send:
axios
.post(PAYMENT_SERVER_URL, {
description,
email: token.email,
source: token.id,
subscriptionID
})
api router:
pipeline :api do
plug(:accepts, ["json"])
end
scope "/api", MyApiWeb do
pipe_through(:api)
options("/users", UserController, :create)
end
api usercontroller
def create(conn, params) do
IO.puts(options)
end
for now I'd be very happy with just logging it out.
来源:https://stackoverflow.com/questions/51454195/pheonix-api-options-call-shows-empty-params