NAME
Mojolicious::Plugin::MoreHelpers - More helpers lacking in Mojolicious
SYNOPSIS
# Mojolicious
$app->plugin('MoreHelpers');
# Mojolicious::Lite
plugin 'MoreHelpers';
DESCRIPTION
Mojolicious::Plugin::MoreHelpers is a mingle of helpers lacking in Mojolicious Web framework for REST-like APIs.
HELPERS
Mojolicious::Plugin::MoreHelpers implements the following helpers.
route_params
my $params = $c->route_params(@names);
Recursive collect current route params and his parents.
validation_json
my $v = $c->validation_json;
Merge flat request JSON object with validation.
headers_more
my $h = $c->headers_more(%headers);
Set multiple reponse headers in one time.
reply_json->success
$c->reply_json->success($data, %onward);
Render the success JSON object with status code, depend on POST or GET request.
reply_json->bad_request
$c->reply_json->bad_request(%onward);
Render empty JSON object with 400 Bad Request HTTP status.
reply_json->unquthorized
$c->reply_json->unauthorized(%onward);
Render empty JSON object with 401 HTTP status.
reply_json->forbidden
$c->reply_json->forbidden(%onward);
Render empty JSON object with 403 Forbidden HTTP status.
reply_json->not_found
$c->reply_json->not_found(%onward);
Render empty JSON object with 404 Not Found HTTP status.
reply_json->not_acceptable
$c->reply-_json>not_acceptable(%onward);
Render empty JSON object with 406 HTTP status.
reply_json->unprocessable
$c->reply_json->unprocessable(%onward);
Render empty JSON object with 422 HTTP status.
reply_json->locked
$c->reply_json->locked(%onward);
Render empty JSON object with 423 HTTP status.
reply_json->rate_limit
$c->reply_json->rate_limit(%onward);
Render empty JSON object with 429 HTTP status.
reply_json->unavailable
$c->reply_json->unavailable(%onward);
Render empty JSON object with 503 HTTP status.
reply_json->catch
$c->reply_json->catch($message, $status, %onward);
Dispatch with status and render properly error code.
METHODS
Mojolicious::Plugin::MoreHelpers inherits all methods from Mojolicious::Plugin and implements the following new ones.
register
$plugin->register(Mojolicious->new);
Register helpers in Mojolicious application.
SEE ALSO
SUPPORT
Bugs / Feature Requests
Bugs should always be submitted via the GitHub bug tracker.
https://github.com/bitnoize/mojolicious-plugin-morehelpers/issues
Source Code
Feel free to fork the repository and submit pull requests.
https://github.com/bitnoize/mojolicious-plugin-morehelpers
AUTHOR
Dmitry Krutikov <monstar@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2020 Dmitry Krutikov.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.