Serve covers under API namespace as well
This commit is contained in:
@@ -5,7 +5,7 @@ defmodule MusicLibraryWeb.CollectionJSON do
|
||||
%{
|
||||
artists: Enum.map(record.artists, & &1.name),
|
||||
title: record.title,
|
||||
cover_url: url(~p"/covers/#{record.id}?#{[vsn: record.cover_hash]}")
|
||||
cover_url: url(~p"/api/covers/#{record.id}?#{[vsn: record.cover_hash]}")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,6 +57,7 @@ defmodule MusicLibraryWeb.Router do
|
||||
pipe_through :api
|
||||
|
||||
get "/collection/latest", CollectionController, :latest
|
||||
get "/covers/:record_id", CoverController, :show
|
||||
end
|
||||
|
||||
# Enable LiveDashboard in development
|
||||
|
||||
@@ -30,7 +30,8 @@ defmodule MusicLibraryWeb.CollectionControllerTest do
|
||||
assert json_response(conn, 200) == %{
|
||||
"artists" => ["Steven Wilson"],
|
||||
"title" => record.title,
|
||||
"cover_url" => "http://localhost:4002/covers/#{record.id}?vsn=#{record.cover_hash}"
|
||||
"cover_url" =>
|
||||
"http://localhost:4002/api/covers/#{record.id}?vsn=#{record.cover_hash}"
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user