Open nathggns opened 11 years ago
The router would have to be a middleware as well. This requires a little rewrite of our request system so far. We need to discuss more specific details.
How so? :S — Nathaniel Higgins http://nath.is
On Sat, Jun 8, 2013 at 7:15 PM, Claudio Albertin notifications@github.com wrote:
The router would have to be a middleware as well. This requires a little rewrite of our request system so far. We need to discuss more specific details.
Reply to this email directly or view it on GitHub: https://github.com/Scaffold/Scaffold/issues/129#issuecomment-19152958
A lot like middleware works with connect.js.
I haven't used connect.js… would you like to explain? — Nathaniel Higgins http://nath.is
On Sat, Jun 8, 2013 at 8:29 PM, Claudio Albertin notifications@github.com wrote:
A lot like middleware works with connect.js.
Reply to this email directly or view it on GitHub: https://github.com/Scaffold/Scaffold/issues/129#issuecomment-19154089
One middleware after the other is called and can register an error in which case the next middleware can decide whether it wants to handle the request or just pass on the error. Once the pointer has reached the end of the middleware queue, ... well, the request is considered handled. This is also a fancy way to implement automatically sending the request.
I'd rather a less drastic change to be honest. Ability to hook a callback that has access to the request object, and can decide to stop the request and throw an error if needs be.
On 8 June 2013 20:40, Claudio Albertin notifications@github.com wrote:
One middleware after the other is called and can register an error in which case the next middleware can decide whether it wants to handle the request or just pass on the error. Once the pointer has reached the end of the middleware queue, ... well, the request is considered handled. This is also a fancy way to implement automatically sending the request.
— Reply to this email directly or view it on GitHubhttps://github.com/Scaffold/Scaffold/issues/129#issuecomment-19154242 .
Nathaniel Higgins http://nath.is @nathggns http://twitter.com/nathggns
You should be able to assign one or more "middlewares" that act before the controller, and can actually stop the controller from being called.
This can be used for authentication, for example.
I'd like to merge this into #128, so we can add a middleware to prevent CONSOLE requests via HTTP.
What do you think?