defmodule CMSWeb.PostController do use CMSWeb, :controller alias CMS.Posts def index(conn, _params) do posts = Posts.list_posts() conn |> assign(:posts, posts) |> render(:index) end def show(conn, %{"post_id" => post_id}) do post = Posts.get_post!(post_id) conn |> assign(:post, post) |> render(:show) end end