It's Mojolicious you can have you cake and eat it too
so
/cities/paris/show
my $city = "paris";
$rapi->route("/cities/$city/:my_action") ->to("cities#$city")
which I think would give you
/cities/Paris/show
and in the 'Cities' conroller
sub paris {
my $self =shift
if ( $self->param("my_action") eq 'show'){
$self->render('/paris/Le_Chabanais');
}
}
Date: Mon, 27 Jan 2014 14:08:13 -0800
From: [email protected]
To: [email protected]
Subject: [Mojolicious] Re: Help on RESTful routes
This changes a bit how my routes will look
I'm really going after this
/cities/Paris/:action
than
/cities/:action/Paris
it appeals to me more, for the thing that I'm doing
On Saturday, January 25, 2014 12:03:10 AM UTC+2, Sergey Stah wrote:
Why??? Do you will to do controller for each city?? O_o
Why not it's?
/controller/:action/*cities
/controller/:action/*cities/*street/
/controller/:action/*cities/*street/*house
/city/show/Paris - City.pm, action show, param{city} = Paris
/city/show/ - City.pm, action show, param{} if empty-show all
/city/show/Paris/Rue Abel/2 - City.pm, action show, param{city}=Paris,
param{street}=Rue Abel, param{house}=2
/city/add/Antanannarivu - City.pm, action add, param{city}=Antanannarivu
/city/delete/East Berlin - City.pm action delete, param{city}=East Berlin
пятница, 24 января 2014 г., 21:40:56 UTC+2 пользователь LesPaul7String написал:
To answer my own question
for an route like this:
/cities/:id/neighborhoods/:id/:
All i have to do is to have an controller as city name and then construct the
route like this
/cities/:controller/:action
then, when accessing
/cities/paris/show
it will pass through Paris.pm controller, action=>show
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/groups/opt_out.