Packages
shopifex
2.1.5
2.4.0
2.3.0
2.2.2
2.2.1
2.2.0
2.1.20
2.1.19
2.1.18
2.1.17
2.1.16
2.1.15
2.1.14
2.1.13
2.1.12
2.1.11
2.1.10
2.1.9
2.1.8
2.1.7
2.1.6
2.1.5
2.1.4
2.1.3
2.1.2
2.1.1
2.1.0
2.0.1
2.0.0
1.1.1
1.1.0
1.0.1
1.0.0
0.6.2
0.6.1
0.6.0
0.5.7
0.5.6
0.5.5
0.5.4
0.5.3
0.5.2
0.5.1
0.5.0
0.4.1
0.4.0
0.3.6
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0
0.2.1
0.2.0
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
Phoenix boilerplate for Shopify Embedded App SDK
Current section
Files
Jump to
Current section
Files
lib/shopifex_web/routes.ex
defmodule ShopifexWeb.Routes do
defmacro pipelines do
quote do
pipeline :shopifex_browser do
plug(:accepts, ["html"])
plug(:fetch_session)
plug(:fetch_flash)
plug(:put_secure_browser_headers)
plug(Shopifex.Plug.LoadInIframe)
end
pipeline :shopify_session do
plug(Shopifex.Plug.ShopifySession)
plug(Shopifex.Plug.EnsureScopes)
plug(Shopifex.Plug.LoadInIframe)
end
pipeline :validate_install_hmac do
plug(Shopifex.Plug.ValidateHmac)
end
pipeline :shopify_webhook do
plug(:fetch_session)
plug(Shopifex.Plug.FetchFlash)
plug(Shopifex.Plug.ShopifyWebhook)
end
pipeline :shopify_admin_link do
plug(:accepts, ["json"])
plug(:fetch_session)
plug(Shopifex.Plug.FetchFlash)
plug(Shopifex.Plug.LoadInIframe)
plug(Shopifex.Plug.ShopifyWebhook)
plug(Shopifex.Plug.EnsureScopes)
end
pipeline :shopify_api do
plug(CORSPlug, origin: "*")
plug(:accepts, ["json"])
plug(
Guardian.Plug.Pipeline,
module: Shopifex.Guardian,
error_handler: ShopifexWeb.AuthErrorHandler
)
plug(Guardian.Plug.VerifyHeader)
plug(Guardian.Plug.EnsureAuthenticated)
plug(Guardian.Plug.LoadResource)
end
pipeline :shopifex_api do
plug(CORSPlug, origin: "*")
plug(:accepts, ["json"])
plug(
Guardian.Plug.Pipeline,
module: Shopifex.Guardian,
error_handler: ShopifexWeb.AuthErrorHandler
)
plug(Guardian.Plug.VerifyHeader)
plug(Guardian.Plug.EnsureAuthenticated)
plug(Guardian.Plug.LoadResource)
end
end
end
defmacro auth_routes(controller \\ ShopifexWeb.AuthController) do
quote do
scope "/auth" do
pipe_through([:shopifex_browser, :shopify_session])
get("/", unquote(controller), :auth)
end
scope "/auth" do
pipe_through([:shopifex_browser, :validate_install_hmac])
get("/install", unquote(controller), :install)
get("/update", unquote(controller), :update)
end
scope "/initialize-installation" do
pipe_through([:shopifex_browser])
get("/", unquote(controller), :initialize_installation)
end
end
end
defmacro payment_routes(controller \\ ShopifexWeb.PaymentController) do
quote do
scope "/payment" do
pipe_through([:shopifex_browser, :shopify_session])
get("/show-plans", unquote(controller), :show_plans)
post("/select-plan", unquote(controller), :select_plan)
end
scope "/payment" do
pipe_through([:shopifex_browser])
get("/complete", unquote(controller), :complete_payment)
end
scope "/payment" do
pipe_through([:shopify_api])
scope "/api" do
options("/select-plan", unquote(controller), :select_plan)
post("/select-plan", unquote(controller), :select_plan)
end
end
end
end
end