Mojolicious::Plugin::Restify::OtherActions - Mojolicious plug-in which extends Restify with more actions
version 0.04
plugin 'Restify::OtherActions';
Extends Mojolicious::Plugin::Restify allowing to call other methods over REST collection
When you create your controller (see Mojolicious::Plugin::Restify documentation), you can use, as an example, this list method
sub list { my $c = shift; my $query = $c->stash('query'); return $c->$query if ($query); ...your original list code ... }
to redirect your call to an alternative $query method.
$query
As an example, if your endpoint is /accounts then /accounts/list/my_method/other/parameters is redirect to $c->my_method and remaining url is available in $c->stash->('opt').
/accounts
/accounts/list/my_method/other/parameters
$c->my_method
$c->stash->('opt')
In addition to standard routes added by Mojolicious::Plugin::Restify, a new route is added
# Pattern Methods Name Class::Method Name # ------- ------- ---- ------------------ # .... # +/list/:query/*opt GET accounts_otheractions Accounts::list
This module extends Mojolicious::Plugin::Restify but solves also a little bug in route naming.
In Mojolicious::Plugin::Restify /accounts and /accounts/:accounts_id have the same name (accounts).
This module replace the second route appending "_id" so that in original module where there is
# Pattern Methods Name Class::Method Name # ------- ------- ---- ------------------ # ... # +/:accounts_id * "accounts"
here there is
# +/:accounts_id * "accounts_id".
There is a pull request in github repository for this little problem
https://github.com/kwakwaversal/mojolicious-plugin-restify/pull/19
Please report any bugs through the web interface at https://github.com/EmilianoBruni/Mojolicious-Plugin-Restify-OtherActions/issues If you want to contribute changes or otherwise involve yourself in development, feel free to fork the Git repository from https://github.com/EmilianoBruni/Mojolicious-Plugin-Restify-OtherActions/.
You can find this documentation with the perldoc command too.
perldoc Mojolicious::Plugin::Restify::OtherActions
Emiliano Bruni <info@ebruni.it>
This software is copyright (c) 2021 by Emiliano Bruni.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Mojolicious::Plugin::Restify::OtherActions, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojolicious::Plugin::Restify::OtherActions
CPAN shell
perl -MCPAN -e shell install Mojolicious::Plugin::Restify::OtherActions
For more information on module installation, please visit the detailed CPAN module installation guide.