NAME

OX::RouteBuilder::HTTPMethod - OX::RouteBuilder which routes to a method in a controller based on the HTTP method

VERSION

version 0.14

SYNOPSIS

package MyApp;
use OX;

has controller => (
    is  => 'ro',
    isa => 'MyApp::Controller',
);

router as {
    route '/' => 'controller';
};

DESCRIPTION

This is an OX::RouteBuilder which allows to a controller class based on the HTTP method used in the request. The action_spec should be a string corresponding to a service which provides a controller instance. When a request is made for the given path, it will look in that class for a method which corresponds to the lowercased version of the HTTP method used in the request (for instance, get, post, etc). If no method is found, it will fall back to looking for a method named any. If that isn't found either, an error will be raised.

action will automatically be added to the route as a default, as well as name (which will be set to the same thing as action).

AUTHORS

  • Stevan Little <stevan.little@iinteractive.com>

  • Jesse Luehrs <doy@tozt.net>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Infinity Interactive.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.