19 lines
344 B
Elixir
19 lines
344 B
Elixir
defmodule Web.PostController do
|
|
use Web, :controller
|
|
|
|
def index(conn, _params) do
|
|
posts = Core.Posts.list_posts()
|
|
|
|
conn
|
|
|> assign(:posts, posts)
|
|
|> render(:index)
|
|
end
|
|
|
|
def show(conn, %{"post_id" => post_id}) do
|
|
post = Core.Posts.get_post!(post_id)
|
|
|
|
conn
|
|
|> assign(:post, post)
|
|
|> render(:show)
|
|
end
|
|
end
|