Current section

Files

Jump to
maat_feather lib maat_feather_web router.ex
Raw

lib/maat_feather_web/router.ex

defmodule MaatFeatherWeb.Router do
use MaatFeatherWeb, :router
pipeline :api do
plug :accepts, ["json"]
end
pipeline :auth do
plug MaatFeatherWeb.Plug.Auth
end
pipeline :browser do
plug Ueberauth
end
scope "/api/v1/auth", MaatFeatherWeb do
pipe_through [:api]
post "/signin", AuthController, :signin
post "/signup", UserController, :create
get "/account_verification", AuthController, :account_verification
end
scope "/api/v1/o_auth", MaatFeatherWeb do
pipe_through [:browser]
get "/:provider", OAuthController, :request
get "/:provider/callback", OAuthController, :callback
post "/:provider/callback", OAuthController, :callback
end
scope "/api/v1", MaatFeatherWeb do
pipe_through [:api, :auth]
get "/profile", AuthController, :profile
get "/refresh_token", AuthController, :refresh_token
put "/users/:address", UserController, :update
get "/auth/totp_qrcode", AuthController, :totp_qrcode
end
# Enables LiveDashboard only for development
#
# If you want to use the LiveDashboard in production, you should put
# it behind authentication and allow only admins to access it.
# If your application does not have an admins-only section yet,
# you can use Plug.BasicAuth to set up some basic authentication
# as long as you are also using SSL (which you should anyway).
if Mix.env() in [:dev, :test] do
import Phoenix.LiveDashboard.Router
scope "/" do
pipe_through [:fetch_session, :protect_from_forgery]
live_dashboard "/dashboard", metrics: MaatFeatherWeb.Telemetry
end
end
# Enables the Swoosh mailbox preview in development.
#
# Note that preview only shows emails that were sent by the same
# node running the Phoenix server.
if Mix.env() == :dev do
scope "/dev" do
pipe_through [:fetch_session, :protect_from_forgery]
forward "/mailbox", Plug.Swoosh.MailboxPreview
end
end
end