diff --git a/lib/podcast_feed_web/controllers/feed_controller.ex b/lib/podcast_feed_web/controllers/feed_controller.ex index 6927dd4..7457eb0 100644 --- a/lib/podcast_feed_web/controllers/feed_controller.ex +++ b/lib/podcast_feed_web/controllers/feed_controller.ex @@ -7,4 +7,11 @@ defmodule PodcastFeedWeb.FeedController do |> put_resp_content_type("text/xml") |> render("feed.xml", podcast: podcast, items: items) end + + def by_identifier(conn, %{"identifier" => identifier}) do + %{podcast: podcast, items: items} = PodcastFeed.archive(identifier) + conn + |> put_resp_content_type("text/xml") + |> render("feed.xml", podcast: podcast, items: items) + end end diff --git a/lib/podcast_feed_web/router.ex b/lib/podcast_feed_web/router.ex index 1144ff8..83d0d4a 100644 --- a/lib/podcast_feed_web/router.ex +++ b/lib/podcast_feed_web/router.ex @@ -19,6 +19,12 @@ defmodule PodcastFeedWeb.Router do get "/ape-milano", FeedController, :apeMilano end + scope "/podcast", PodcastFeedWeb do + pipe_through :browser + + get "/:identifier", FeedController, :by_identifier + end + # Other scopes may use custom stacks. # scope "/api", PodcastFeedWeb do # pipe_through :api