:fetch_session plug :accepts, ["html"] end scope "/" do pipe_through :browser get "/pages/:page", PageController, :show resources "/users", UserController, except: [:delete] end end
["jose", "eric", "sonny"] def show(conn, params) do user = Repo.get(User, id) render conn, "show.html", user: user end defp authenticate(conn, options) do if get_session(conn, :username) in options[:usernames] do conn else conn |> redirect(to: "/") |> halt() end end end
[], name: __MODULE__) end def init(_opts) do children = [ worker(MyApp, [], restart: :temporary) ] supervise children, strategy: :simple_one_for_one end end