add example for top links

This commit is contained in:
Yanick Champoux 2023-10-31 16:30:01 -04:00
parent 7a9e68a108
commit 6debdda412

View File

@ -58,6 +58,14 @@ $registry->add_type(
count => $xtra->{count}, count => $xtra->{count},
total => 0+ @$data, total => 0+ @$data,
} }
},
top_level_links => {
self => '/articles',
},
links => {
self => sub($data,@) {
return "/articles/" . $data->{id};
},
} }
} }
); );
@ -72,6 +80,9 @@ like $output => {
"count"=> 2, "count"=> 2,
"total"=> 1 "total"=> 1
}, },
"links"=> {
"self"=> "/articles"
},
}; };
done_testing(); done_testing();