perl - Catalyst Chained routing "loop" -


i've got problem wasn't able solve yet, , hope can :)

i have build cataplack-application web-interface. supposed establish json/rest/xml-api, thought this:

/ => root /blog/ => ...  /news/ => ... /api =>chainedto(root) pathpart(api) args(1) { set_view($arg) }; 

how loop api root (/), can redispatch whole request different view without having establish lot of "fake routines" ?

i feel there must clean way ...

have @ differences between $c->forward / $c->detach , $c->visit / $c->go in manual. think you'll find can build $c->go() construct within api method achieves you're after.

it's still bit messy though, particularly if have de-reference uri action manually.

you can achieve same effect lot less hassle adding 'api' path-part @ end rather beginning, becomes argument request can test in auto sub, , set whatever stash variables need. don't need re-dispatching. can decide whether such uri scheme clean enough , appropriate application.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -