[Dancer-users] getting the routes info for `load_app` loaded apps
Puneet Kishor
punk.kish at gmail.com
Fri Dec 2 16:18:16 CET 2011
On Dec 2, 2011, at 9:01 AM, Puneet Kishor wrote:
> I have written a plugin (modeled after Dancer::Plugin::SiteMap) that allows me to create a few standard routes that are available in all applications. For example, by adding my plugin (I call it Dancer::Plugin::Meta), my applications automatically get a route called http://server/app/meta/author which returns the author information set in the config file.
>
> This works rather well, and has become a key part of the app (there are other fairly useful routes besides author that get added, such as license, version, and most importantly, a listing of all the routes much like the SiteMap).
>
> Now I have an application where sub-applications are loaded using
>
> load_app 'app1', prefix -> '/app1';
> load_app 'app2', prefix -> '/app2';
>
> This also works rather well, except now my plugin doesn't work. My base app is reachable at `http://server/baseapp` so the following URI works `http://server/baseapp/meta/author` but `http://server/baseapp/app1/meta/author` doesn't work... I get the void.
>
> Additionally, while `http://server/baseapp/meta/author` works, `http://server/baseapp/meta/resources` does not work. Normally, /meta/resources returns a listing of all the resources, but now I get the following error
>
> "Serializer (Dancer::Serializer::JSON) failed at serializing HASH(0x7f9ae4696f00):\nencountered object '(?^:^\\/baseapp(?:\\/)?$)', but neither allow_blessed nor convert_blessed settings are enabled at /opt/local/lib/perl5/site_perl/5.14.1/JSON.pm line 154.\n"
solved the above problem. Now, I am able to get *all* the resources when I go to `http://server/basemap/meta/resource` but I reach the void when I go to `http://server/basemap/app1/meta/resource`. Ideally, I would like to go to a particular sub app and have the meta routes available at the sub apps.
--
Puneet Kishor
More information about the Dancer-users
mailing list