Hi Justin,
On 7 May 2009, at 18:33, Justin Sheehy wrote:
I've now changed the dispatcher such that it should be useful outside
of webmachine without affecting internal use.
Check out
http://bitbucket.org/justin/webmachine/src/tip/src/webmachine_dispatcher.erl
if you want to see it. As with much Erlang, the actual volume of
code is
quite small. It is all Apache2 licensed, so there should be no
problem if you
want to use that module in couchdb for this purpose.
The API is quite simple. Just call webmachine_dispatcher:dispatch/2
with
a path and a list of the dispatch terms I explained in the other
email. A trivial
example:
1> webmachine_dispatcher:dispatch("/a",[{["a"],some_resource,[]}])
{some_resource,[],[],[],".",[]}
I suspect that you won't have much trouble turning JSON forms into
dispatch terms.
I'm interested to hear how it works out for you, and welcome any
suggestions.
This looks great, thanks very much! I'll let you know how I get on.
--
Jason Davies
www.jasondavies.com