defmodule EServerWeb.Router do
use EServerWeb, :router #make route fts available here
pipeline :browser do #middleware
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", EServerWeb do
pipe_through :browser
#first clause to match
get "/", PageController, :index
get "/hello", HelloController, :index
get "/hello/:messenger", HelloController, :show
resources "/users", UserController
end
forward "/jobs", BackgroundJob.Plug
# Other scopes may use custom stacks.
# scope "/api", EServerWeb do
# pipe_through :api
# end
end
get "/hello", HelloController, :index
resources "/users", UserController
resources "/posts", PostController, only: [:index, :show]
resources "/actions", ActionController, except: [:new, :edit, :show]
get is actually a Phoenix macro that is one clause of a match for HTTP get request
Error handling in the default error view, default is returning name from status code