api: inline ROUTES

This commit is contained in:
Lucas 2023-02-19 12:17:51 +00:00
parent 1ac5d07821
commit 861593d26d

View File

@ -7,16 +7,6 @@ our $VERSION = v0;
set serializer => "JSON"; set serializer => "JSON";
use constant { use constant {
ROUTES => [
{ path => "/meta", verb => "GET" },
{ path => "/tags", verb => "GET" },
{ path => "/tags", 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", DEFAULT_CONTENT_TYPE => "application/json",
}; };
@ -46,7 +36,15 @@ sub mkpager ($)
} }
get "/meta" => sub { get "/meta" => sub {
return ROUTES; return [
{ path => "/meta", verb => "GET" },
{ path => "/tags", verb => "GET" },
{ path => "/tags", 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" },
],
}; };
get "/tags" => sub { get "/tags" => sub {