diff --git a/lib/PoorBooru/API/V0.pm b/lib/PoorBooru/API/V0.pm index 2d048ff..3b0e9e6 100644 --- a/lib/PoorBooru/API/V0.pm +++ b/lib/PoorBooru/API/V0.pm @@ -7,19 +7,22 @@ our $VERSION = v0; set serializer => "JSON"; set database => "db/booru.db"; -my $DEFAULT_CONTENT_TYPE = "application/json"; -my @ROUTES = ( - { path => "/meta", verb => "GET" }, - { path => "/tags", verb => "GET" }, - { path => "/tags/new", verb => "POST" }, - { path => "/tag/:tag_id_or_name", verb => "GET" }, - { path => "/media/:media_id", verb => "GET" }, - { path => "/download/:media_id", verb => "GET" }, - { path => "/random", verb => "GET" }, -); +use constant { + ROUTES => [ + { path => "/meta", verb => "GET" }, + { path => "/tags", verb => "GET" }, + { path => "/tags/new", verb => "POST" }, + { path => "/tag/:tag_id_or_name", verb => "GET" }, + { path => "/media/:media_id", verb => "GET" }, + { path => "/download/:media_id", verb => "GET" }, + { path => "/random", verb => "GET" }, + ], + + DEFAULT_CONTENT_TYPE => "application/json", +}; get "/meta" => sub { - return \@ROUTES; + return ROUTES; }; get "/tags" => sub { @@ -96,7 +99,7 @@ get "/download/:media_id" => sub { send_file( \$media->content, - content_type => $media->content_type // $DEFAULT_CONTENT_TYPE, + content_type => $media->content_type // DEFAULT_CONTENT_TYPE, filename => $media->filename, ); };