[Dancer-users] a REST question immediately followed by a Dancer-implementation question

Mr. Puneet Kishor punk.kish at gmail.com
Fri Sep 30 16:07:46 CEST 2011


A few additional thoughts --

I guess I am looking for a "metaprotocol" (just learned that word on reading about Moo, and wanted to use it) that returns all the routes in the app, combined with some kind of params-validate + error reporting mechanism.

So, companion questions -- for you Dancers, what are the params-validate and croak/confess/carp modules of choice? I (and I believe most of you) tend to lean toward lean and light, something that doesn't profess to do everything in the world, but in return, is a few orders of magnitude lighter than the big-well-known-brand out there.


On Sep 30, 2011, at 8:51 AM, Mr. Puneet Kishor wrote:

> So, I have a lot of methods such as 
> 	get '/foo' => { .. };
> 	get '/bar' => { .. };
> 	get '/baz' => { .. };
> 	get '/qux' => { .. };
> 
> All the above methods are reachable via a browser in which they depict some visual representation of the data.
> 
> Most of the above methods have their '.:format' counterparts, mostly returning JSON packets when reached either via the browser or via the command line.
> 
> All the methods above return something by default or modified by parameters. So, "http://server/app/foo" may work, or may require some parameters as in "http://server/app/foo?age=27&before=yesterday&for=rascals"
> 
> I would like to implement a "meta" method, say
> 
> 	get '/rest' => { .. };
> 
> which should return a listing of all the methods above, along with their parameters, if any, and whether those parameters are optional or required.
> 
> 	http://server/app/rest
> 	{"resources": [
> 		{"name": "foo, "params": [
> 			{"required": [
> 				{"name": "age", "type": "int"}
> 			]},
> 			{"optional": [
> 				{"name": "before", "type": "string"}
> 				{"name": "for", "type": "string"}
> 			]},
> 		]}
> 	]}
> 
> In other words, this meta method returns all the resources available at the http://server/app.
> 
> Of course, I could code this for each app, but it would be nice to automate it.
> 
> Suggestions? Ideas?
> 
> 
> --
> Puneet Kishor



More information about the Dancer-users mailing list