tedeh/jayson — pull request #30 by chmeldax (2014-09-11 13:06:19+00:00)
Title: Changes to server.middleware

Hey!

I have encountered an issue while trying to use **jayson** as a *middleware* for Connect. Let me introduce one use case:

Our app is used as a JSON-RPC server, where users needs authorization. So, in order to achieve that, we would like to have one "route" for serving authorization (creating sessions etc.) and other "route" for serving json-rpc responses. In order to achieve that:

* We have to get name of the json-rpc method (e.g. "signIn") and invoke authorization callback
* Use Connect middleware for creating sessions
* Send response to user.

So, it would be great if jayson middleware used *next()* instead of *res.end()*. That is the content of the "New option to invoke next() in middleware" commit. I have introduced a new option "shouldContinue" for this purpose.

During testing this, I have encountered a bug. Variable *options* is introduced with **var** keyword, so original *options* is replaced with undefined. I have renamed it.

Regards,
Jan