Git Product home page Git Product logo

p5-amon2-web-dispatcher-routersimple-extended's Introduction

NAME

Amon2::Web::Dispatcher::RouterSimple::Extended - extending Amon2::Web::Dispatcher::RouterSimple

SYNOPSIS

package MyApp::Web::Dispatcher;
use strict;
use warnings;
use utf8;
use Amon2::Web::Dispatcher::RouterSimple::Extended;
connect '/' => 'Root#index';
# API
submapper '/api/' => API => sub {
    get  'foo' => 'foo';
    post 'bar' => 'bar';
};
# user
submapper '/user/' => User => sub {
    get     '',           'index';
    connect '{uid}',      'show';
    post    '{uid}/hoge', 'hoge';
    connect 'new',        'create';
};
1;

DESCRIPTION

This is an extension of Amon2::Web::Dispatcher::RouterSimple. 100% compatible, and it provides useful functions.

METHODS

  • get $path, "${controller}#${action}"

this is equivalent to 'connect $path, { controller => $controller, action => $action }, { method => 'GET' };'

  • post $path, "${controller}#${action}"

this is equivalent to 'connect $path, { controller => $controller, action => $action }, { method => 'POST' };'

  • put $path, "${controller}#${action}"

this is equivalent to 'connect $path, { controller => $controller, action => $action }, { method => 'PUT' };'

  • delete $path, "${controller}#${action}"

this is equivalent to 'connect $path, { controller => $controller, action => $action }, { method => 'DELETE' };'

  • submapper $path, $controller, sub {}

this is main feature of this module. In subroutine of the third argument, connect/get/post/put/delete method fits in submapper. As a results, in submapper you can be described in the same interface. If this third argument not exists, this function behave in the same way as Amon2::Web::Dispatcher::RouterSimple.

Copyright (C) taiyoh

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

AUTHOR

taiyoh

SEE ALSO

Amon2::Web::Dispatcher::RouterSimple

p5-amon2-web-dispatcher-routersimple-extended's People

Contributors

taiyoh avatar

Watchers

Zak B. Elep avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.