Hello, I have a Phoenix Elixir API, and a Node Js web app. When I tested the API on postman it worked great, when I tried to use it with the webb app, then it fails.
I searched on the net, and found out that I should use the CorsPlug, which is what I did.
I’ve updated both my router.ex
file and the endpoint.ex
file.
my router.ex
file :
...
pipeline :api do
plug CORSPlug, origin: "*"
plug :accepts, ["json"]
end
scope "/api", Theme01Web do
pipe_through :api
resources("/users", UsersController)
...