Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 826 Bytes

README.md

File metadata and controls

35 lines (25 loc) · 826 Bytes

ex_cors

Build Status

An Elixir Plug-based CORS middleware for Phoenix Framework.

Installation

The package can be installed by adding ex_cors to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_cors, "~> 0.2"},
    # ...
  ]
end

After you're done, run mix deps.get in your terminal to fetch and compile all dependencies.

Usage

ex_cors is intended to work with Phoenix.Enpoint. The only thing you have to do in order to make it working is to modify your_app/lib/your_app/web/endpoint.ex as follows:

defmodule YourApp.Endpoint do
  use Phoenix.Enpoint, otp_app: :your_app

  # ...
  plug ExCors.AllowCorsRequests
  plug YourApp.Router
  # ...
end