[Dancer-users] a REST question immediately followed by a Dancer-implementation question
Mr. Puneet Kishor
punk.kish at gmail.com
Fri Sep 30 15:51:15 CEST 2011
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