feat: added route to generate podcast throug identifier in the url

This commit is contained in:
danilo silva 2020-05-23 21:56:20 +00:00
parent 6b042f65ab
commit 04ac723c12
2 changed files with 13 additions and 0 deletions

View file

@ -7,4 +7,11 @@ defmodule PodcastFeedWeb.FeedController do
|> put_resp_content_type("text/xml") |> put_resp_content_type("text/xml")
|> render("feed.xml", podcast: podcast, items: items) |> render("feed.xml", podcast: podcast, items: items)
end 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 end

View file

@ -19,6 +19,12 @@ defmodule PodcastFeedWeb.Router do
get "/ape-milano", FeedController, :apeMilano get "/ape-milano", FeedController, :apeMilano
end end
scope "/podcast", PodcastFeedWeb do
pipe_through :browser
get "/:identifier", FeedController, :by_identifier
end
# Other scopes may use custom stacks. # Other scopes may use custom stacks.
# scope "/api", PodcastFeedWeb do # scope "/api", PodcastFeedWeb do
# pipe_through :api # pipe_through :api