So I have a very simple signup/login website, signup works very well but when it comes to login, it does not do anything, people already suggested my to use corsica but I have no clue how to move that over. this is how my router.ex
looks like
defmodule TestWeb.Router do
use TestWeb, :router
pipeline :api do
plug TestWeb.Plugs.RateLimiter
plug :accepts, ["json"]
plug TestWeb.Plugs.AuthPlug
end
scope "/", TestWeb do
pipe_through :api
post "/login", UserController, :login
post "/signup", UserController, :signup
get "/test", UserController, :test
# The old CORS stuff that I have to move over to endpoint.ex
options "/login", UserController, :login
options "/signup", UserController, :signup
options "/test", UserController, :test
end
end
My endpoint.ex
currently looks like this
plug Corsica, origins: "*"
but what else do I have to add to the endpoint and remove from the router? because in the endpoint file I cant use pipeline (like in the router) as its a unknown function. Its the first time for me attempting to fix CORS issues in general + very new to phoenix. Yes, I already looked at the docs but I only was able to move over that one line and I feel like I am still missing something