2017-12-08 09:58:14 +01:00
|
|
|
defmodule EventosWeb.Router do
|
2018-01-14 17:56:50 +01:00
|
|
|
@moduledoc """
|
|
|
|
Router for eventos app
|
|
|
|
"""
|
2017-12-08 09:58:14 +01:00
|
|
|
use EventosWeb, :router
|
|
|
|
|
|
|
|
pipeline :api do
|
|
|
|
plug :accepts, ["json"]
|
|
|
|
end
|
|
|
|
|
2017-12-09 14:58:37 +01:00
|
|
|
pipeline :api_auth do
|
2018-01-13 23:33:03 +01:00
|
|
|
plug :accepts, ["json"]
|
2017-12-09 14:58:37 +01:00
|
|
|
plug EventosWeb.AuthPipeline
|
2017-12-08 09:58:14 +01:00
|
|
|
end
|
|
|
|
|
2018-01-09 17:52:26 +01:00
|
|
|
pipeline :browser do
|
|
|
|
plug :accepts, ["html"]
|
|
|
|
plug :fetch_session
|
|
|
|
plug :fetch_flash
|
|
|
|
plug :protect_from_forgery
|
|
|
|
plug :put_secure_browser_headers
|
|
|
|
end
|
|
|
|
|
|
|
|
scope "/api", EventosWeb do
|
2017-12-09 14:58:37 +01:00
|
|
|
pipe_through :api
|
2017-12-08 09:58:14 +01:00
|
|
|
|
2018-01-09 17:52:26 +01:00
|
|
|
post "/users", UserController, :register
|
2018-01-13 23:33:03 +01:00
|
|
|
post "/login", UserSessionController, :sign_in
|
|
|
|
resources "/groups", GroupController, only: [:index, :show]
|
|
|
|
resources "/events", EventController, only: [:index, :show]
|
|
|
|
resources "/accounts", AccountController, only: [:index, :show]
|
|
|
|
resources "/tags", TagController, only: [:index, :show]
|
|
|
|
resources "/categories", CategoryController, only: [:index, :show]
|
|
|
|
resources "/sessions", SessionController, only: [:index, :show]
|
|
|
|
resources "/tracks", TrackController, only: [:index, :show]
|
2017-12-08 09:58:14 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
# Other scopes may use custom stacks.
|
|
|
|
scope "/api", EventosWeb do
|
2017-12-09 14:58:37 +01:00
|
|
|
pipe_through :api_auth
|
|
|
|
|
2018-01-13 23:33:03 +01:00
|
|
|
get "/user", UserController, :show_current_account
|
|
|
|
post "/sign-out", UserSessionController, :sign_out
|
|
|
|
resources "/users", UserController, except: [:new, :edit, :show]
|
|
|
|
resources "/accounts", AccountController, except: [:new, :edit]
|
2017-12-09 14:58:37 +01:00
|
|
|
resources "/events", EventController
|
|
|
|
resources "/categories", CategoryController
|
|
|
|
resources "/tags", TagController
|
|
|
|
resources "/event_accounts", EventAccountsController
|
|
|
|
resources "/event_requests", EventRequestController
|
2018-01-09 17:52:26 +01:00
|
|
|
resources "/groups", GroupController, except: [:index]
|
2017-12-09 14:58:37 +01:00
|
|
|
resources "/group_accounts", GroupAccountController
|
|
|
|
resources "/group_requests", GroupRequestController
|
2018-01-13 23:33:03 +01:00
|
|
|
resources "/sessions", SessionController, except: [:new, :edit]
|
|
|
|
resources "/tracks", TrackController, except: [:new, :edit]
|
2017-12-08 09:58:14 +01:00
|
|
|
end
|
2018-01-09 17:52:26 +01:00
|
|
|
|
|
|
|
scope "/", EventosWeb do
|
|
|
|
pipe_through :browser
|
|
|
|
|
2018-01-13 23:33:03 +01:00
|
|
|
get "/*path", PageController, :index
|
2018-01-09 17:52:26 +01:00
|
|
|
end
|
2017-12-08 09:58:14 +01:00
|
|
|
end
|