Re: [nodejs] new framework for json apis

2012-12-18 Thread Gregg Caines
I mostly agree, but I personally think it's worse than you make it out to be. Take a look at the Percolator and express examples at http://percolatorjs.com/examples.html and you'll see that most of the reason that the express version is ~2x longer is due to error handling. I find setting up error

Re: [nodejs] new framework for json apis

2012-12-17 Thread Jake Verbaten
The problem of how do I write a generic request handler but still let the user decide how to handle errors is frustratingly hard. The best solution I have come up with is. router.addRoute("/thing", require("route-handler")({ error: myErrorFramework })) which is annoying at best. you hard couple

Re: [nodejs] new framework for json apis

2012-12-17 Thread Gregg Caines
Very cool, Shaun... Feel free to give me a shout anytime if you have questions, or find bugs. G On Mon, Dec 17, 2012 at 3:55 PM, shaun etherton wrote: > > Hey Gregg > > FWIW. I like it so far and have started to use it. > > I'm mainly experimenting with it at this point, but your framework is

Re: [nodejs] new framework for json apis

2012-12-17 Thread shaun etherton
Hey Gregg FWIW. I like it so far and have started to use it. I'm mainly experimenting with it at this point, but your framework is a good fit for what i was looking for. Thank you. On Tuesday, 18 December 2012 at 2:06 AM, Gregg Caines wrote: > > req.on("end", handler) is an event that only

Re: [nodejs] new framework for json apis

2012-12-17 Thread Gregg Caines
> req.on("end", handler) is an event that only happens once and and will only have a single handler in most cases. Just make request, json and body events and make your $ thing an event emitter. I think you've sold me on that. Good points. > CRUDCollection (its annoying to rename your concepts a

Re: [nodejs] new framework for json apis

2012-12-17 Thread Jake Verbaten
> I used the word 'on' in onRequest(), onJson() and onBody(), but those are not really for streams or even general events and should only ever have 1 handler/listene req.on("end", handler) is an event that only happens once and and will only have a single handler in most cases. Just make request,

Re: [nodejs] new framework for json apis

2012-12-16 Thread Gregg Caines
Ohh good questions... > There doesn't seem to be any support for streams which sucks. Check out http://percolatorjs.com/documentation.html#context-req and http://percolatorjs.com/documentation.html#context-res . Those are the unaltered request and response objects, so you can still stream as wel

Re: [nodejs] new framework for json apis

2012-12-16 Thread Jake Verbaten
Using `onX(cb)` instead of `.on("x", cb)` is going against the grain of node for no reason. I recommend you change that api. There doesn't seem to be any support for streams which sucks. And other then the Hyper+JSON and JSONmodule thing there doesn't seem to be something here that isn't covered

Re: [nodejs] new framework for json apis

2012-12-16 Thread Gregg Caines
Totally agree, but I'm not even done the server-side yet. :) I'm not even entirely sure what the client library should do yet (beyond the standard http stuff like request or super-agent do), and the only consumers of the API I've written with it are in ruby and erlang, so I'm even a little languag

Re: [nodejs] new framework for json apis

2012-12-16 Thread Gregg Caines
I assume you mean the standard HTTP methods? I agree... That would indeed be a no-starter if I'd left those out. :) Check the docs at http://percolatorjs.com/documentation.html#server-route . They show the use of multiple methods on one resource. You can add others as well as you'd no doubt ex

Re: [nodejs] new framework for json apis

2012-12-16 Thread Gregg Caines
Kinda-sorta-almost. That draft makes it look more complicated than it is though. And nothing forces you to follow that format either. You can still make old-school arbitrary json apis like twitter and facebook do, if you really want to. On Sun, Dec 16, 2012 at 11:24 AM, Scott Elcomb wrote: >

Re: [nodejs] new framework for json apis

2012-12-16 Thread Tiger Nassau Inc
Does not seem to use standard REST calls - that is a no start - needs to be as simple as php slim, then would be really nice Sent from my LG Mobile Scott Elcomb wrote: >On Sun, Dec 16, 2012 at 1:38 PM, Gregg Caines wrote: >> Hey all... I've been working on a new framework for restful json apis

Re: [nodejs] new framework for json apis

2012-12-16 Thread Jonathan Chayce Dickinson
Good work! Vannevar Bush would be proud of you :). A client library to consume this would be nice... Jonathan On Sun, Dec 16, 2012 at 9:24 PM, Scott Elcomb wrote: > On Sun, Dec 16, 2012 at 1:38 PM, Gregg Caines wrote: > > Hey all... I've been working on a new framework for restful json apis >

Re: [nodejs] new framework for json apis

2012-12-16 Thread Scott Elcomb
On Sun, Dec 16, 2012 at 1:38 PM, Gregg Caines wrote: > Hey all... I've been working on a new framework for restful json apis for a > while, and was wondering if anyone might be interested in taking a look, > giving feedback, etc. > > http://percolatorjs.com Is it fair to assume that percolatorjs

[nodejs] new framework for json apis

2012-12-16 Thread Gregg Caines
Hey all... I've been working on a new framework for restful json apis for a while, and was wondering if anyone might be interested in taking a look, giving feedback, etc. http://percolatorjs.com It's definitely a bit weird, but of course I think it's the best way to create JSON APIs. I didn'