frenzy/lib/frenzy_web/router.ex

72 lines
1.9 KiB
Elixir

defmodule FrenzyWeb.Router do
use FrenzyWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :authenticate do
plug FrenzyWeb.Plug.Authenticate
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", FrenzyWeb do
pipe_through :browser
get "/login", LoginController, :login
post "/login", LoginController, :login_post
end
scope "/", FrenzyWeb do
pipe_through :browser
pipe_through :authenticate
get "/", GroupController, :index
resources "/groups", GroupController, except: [:edit, :update]
resources "/feeds", FeedController, only: [:show, :create, :delete]
post "/feeds/:id/refresh", FeedController, :refresh
post "/feeds/:id/enable_filter", FeedController, :enable_filter
post "/feeds/:id/disable_filter", FeedController, :disable_filter
resources "/filters", FilterController, only: [:edit, :update]
post "/filters/:id/add_rule", FilterController, :add_rule
post "/filters/:id/remove_rule", FilterController, :remove_rule
resources "/items", ItemController, only: [:show]
post "/items/:id/read", ItemController, :read
post "/items/:id/unread", ItemController, :unread
end
scope "/", FrenzyWeb do
pipe_through :api
get "/fever", FeverController, :get
get "/api/fever.php", FeverController, :get
post "/fever", FeverController, :post
post "/api/fever.php", FeverController, :post
end
scope "/", FrenzyWeb do
pipe_through :api
post "/api/v1/register", FervorController, :register
post "/oauth/token", OauthController, :token
end
scope "/", FrenzyWeb do
pipe_through :browser
get "/oauth/authorize", OauthController, :authorize_get
post "/oauth/authorize", OauthController, :authorize_post
end
end