Skip to content

Commit

Permalink
cors hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Dec 18, 2020
1 parent 43fa2bf commit aff4968
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions server/config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ config :fakers_api, FakersApi.Repo,
# with webpack to recompile .js and .css sources.
config :fakers_api, FakersApiWeb.Endpoint,
http: [port: 4000],
https: [
port: 4001,
cipher_suite: :strong,
certfile: "priv/cert/selfsigned.pem",
keyfile: "priv/cert/selfsigned_key.pem"
],
debug_errors: true,
code_reloader: true,
check_origin: false,
Expand Down
4 changes: 2 additions & 2 deletions server/lib/fakers_api_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ defmodule FakersApiWeb.Router do
use FakersApiWeb, :router

pipeline :graphql do
plug CORSPlug, origin: "*"
plug :accepts, ["json"]
end

scope "/api" do
Expand All @@ -24,7 +26,5 @@ defmodule FakersApiWeb.Router do
pipe_through [:fetch_session, :protect_from_forgery]
live_dashboard "/dashboard", metrics: FakersApiWeb.Telemetry
end

forward "/", Absinthe.Plug.GraphiQL, schema: FakersApiWeb.GraphQL.Schema
end
end
3 changes: 2 additions & 1 deletion server/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ defmodule FakersApi.MixProject do
{:plug_cowboy, "~> 2.0"},
{:absinthe, "~> 1.5.0"},
{:dataloader, "~> 1.0.0"},
{:absinthe_plug, "~> 1.5.0"}
{:absinthe_plug, "~> 1.5.0"},
{:cors_plug, "~> 1.5"}
]
end

Expand Down
2 changes: 2 additions & 0 deletions server/mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"absinthe": {:hex, :absinthe, "1.5.3", "d255e6d825e63abd9ff22b6d2423540526c9d699f46b712aa76f4b9c06116ff9", [:mix], [{:dataloader, "~> 1.0.0", [hex: :dataloader, repo: "hexpm", optional: true]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "69a170f3a8630b2ca489367bc2aeeabd84e15cbd1e86fe8741b05885fda32a2e"},
"absinthe_plug": {:hex, :absinthe_plug, "1.5.0", "018ef544cf577339018d1f482404b4bed762e1b530c78be9de4bbb88a6f3a805", [:mix], [{:absinthe, "~> 1.5.0", [hex: :absinthe, repo: "hexpm", optional: false]}, {:plug, "~> 1.3.2 or ~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "4c160f4ce9a1233a4219a42de946e4e05d0e8733537cd5d8d20e7d4ef8d4b7c7"},
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm", "4a0850c9be22a43af9920a71ab17c051f5f7d45c209e40269a1938832510e4d9"},
"cors_plug": {:hex, :cors_plug, "1.5.2", "72df63c87e4f94112f458ce9d25800900cc88608c1078f0e4faddf20933eda6e", [:mix], [{:plug, "~> 1.3 or ~> 1.4 or ~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "9af027d20dc12dd0c4345a6b87247e0c62965871feea0bfecf9764648b02cc69"},
"corsica": {:hex, :corsica, "1.1.3", "5f1de40bc9285753aa03afbdd10c364dac79b2ddbf2ba9c5c9c47b397ec06f40", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "8156b3a14a114a346262871333a931a1766b2597b56bf994fcfcb65443a348ad"},
"cowboy": {:hex, :cowboy, "2.8.0", "f3dc62e35797ecd9ac1b50db74611193c29815401e53bac9a5c0577bd7bc667d", [:rebar3], [{:cowlib, "~> 2.9.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "4643e4fba74ac96d4d152c75803de6fad0b3fa5df354c71afdd6cbeeb15fac8a"},
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.3.1", "ebd1a1d7aff97f27c66654e78ece187abdc646992714164380d8a041eda16754", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "3a6efd3366130eab84ca372cbd4a7d3c3a97bdfcfb4911233b035d117063f0af"},
"cowlib": {:hex, :cowlib, "2.9.1", "61a6c7c50cf07fdd24b2f45b89500bb93b6686579b069a89f88cb211e1125c78", [:rebar3], [], "hexpm", "e4175dc240a70d996156160891e1c62238ede1729e45740bdd38064dad476170"},
Expand Down

0 comments on commit aff4968

Please sign in to comment.