Skip to content
This repository has been archived by the owner on Jan 27, 2021. It is now read-only.

Commit

Permalink
add sparkpost webhook controller
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaNaumenko committed Sep 10, 2019
1 parent 6d435f1 commit 97db61e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
defmodule HexletBasicsWeb.Api.Webhooks.SparkpostController do
use HexletBasicsWeb, :controller

def process(conn, _params) do
conn
|> send_resp(200, "")
end
end
11 changes: 11 additions & 0 deletions services/app/lib/hexlet_basics_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ defmodule HexletBasicsWeb.Router do
plug(HexletBasicsWeb.Plugs.ApiRequireAuth)
end

pipeline :api_for_webhooks do
plug(:accepts, ["json"])
plug(:fetch_session)
end

scope "/auth", HexletBasicsWeb do
pipe_through(:browser)

Expand All @@ -74,6 +79,12 @@ defmodule HexletBasicsWeb.Router do
end
end

scope "/api/webhooks", HexletBasicsWeb do
pipe_through(:api_for_webhooks)

post("sparkpost/process", Api.Webhooks.SparkpostController, :process)
end

scope "/", HexletBasicsWeb do
# Use the default browser stack
pipe_through(:browser)
Expand Down

0 comments on commit 97db61e

Please sign in to comment.