redstone-dart / redstone

A metadata driven microframework for Dart.
http://redstone-dart.github.io/redstone
MIT License
342 stars 42 forks source link

How to get the function handler based on a URL? #196

Open jodinathan opened 7 years ago

jodinathan commented 7 years ago

Hi,

I need to create a batch controller that will execute several other handlers. Like the facebook graph API, where you can do single post requests and you can also group them into one post that facebook will parse all items like they were sent one by one and return the results in an array. Request example: [ { url: '/something/one', data: { hi: '1'} }, { url: '/something/two', data: { hi: '2'} } ] So my batch controller must iterate through that array, parse the requests and return the result of each handler. I am currently using Mock requests, however, the problem is the result of each execution. My handlers returns an object that is parsed into a Map and then parsed to a string by redstone. With mock requests, after executing the handler, the result is a string within mockContent, then I have to parse the string into an map and then into an object for later use. I would like to skip all that. Since my handlers already return the object I need.

I tried to look into redstone source but it is quite complex, maybe you guys can give me some help to do this faster.

http://stackoverflow.com/questions/40268489/batch-url-execution-with-redstone

thanks