0

In mojolicious app I want define different controller action for url depend on get parameter.

In pseudocode it is:

#test.pl?command=check&id=1
$r->route('/test.pl?command=check')->via('GET')->to(controller => 'bar', action => 'check');

#test.pl?command=confirm&id=12&amount=100
$r->route('/test.pl?command=confirm')->via('GET')->to(controller => 'bar', action => 'confirm');

What I should use? Some kind of bridges? Help me with example please.

G. Cito
  • 6,210
  • 3
  • 29
  • 42
Korjavin Ivan
  • 439
  • 1
  • 5
  • 15

1 Answers1

2

It looks like you can't change your url pattern so one way would be to route to an action like bar::command which then calls the bar::check() or bar::confirm() actions depending on the value of the command parameter

Allan
  • 671
  • 1
  • 5
  • 8