At this point, the request is in the controller, which was called by the router according to the logic we described. We'll build the FileController that we saw in the router, and go through the four actions we've created routes for: index, show, new. and create. Let's begin with the index action:
$ cat apps/elixir_drip_web/lib/elixir_drip_web/controllers/file_controller.exdefmodule ElixirDripWeb.FileController do use ElixirDripWeb, :controller alias ElixirDrip.Storage def index(conn, %{"path" => path}) do with {:ok, media} <- Storage.media_by_folder("hardcoded_user_id", path) do render(conn, "index.html", files: media.files, folders: media.folders, current_path: path) else {:error, :invalid_path} -> conn ...