sloanelybutsurely.com/lib/cms_web/controllers/post_controller.ex
2025-02-22 12:35:49 -05:00

21 lines
359 B
Elixir

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