Oh, that was it, I should have looked to registerRestInterface then (now I see it). I'm learning a lot from your code alone.
On Thu, 21 Aug 2014 22:29:02 GMT, Sönke Ludwig wrote:
On Thu, 21 Aug 2014 22:03:58 GMT, Juanjo Álvarez wrote:
This works perfectly, thanks!
But... how does it work? I mean, how is authPred receiving the HTTPServerRequest and response parameters? I've looked at funcattr.d and I don't see how the magic is done (not that I understand much of that file yet, I'm learning the language as I go).
What basically is done is that
registerRestInterfacesearches for@beforeattributes and then calls the associated function with(req, res)parameters. The code behind which this is hidden is indeed a little hardcore, even for template/CTFE code (it'screateAttributedFunctionwhich creates a wrapper function with the@beforeparameters properly set).
vibe.web.webhandles@beforein a little more direct way and this will be changed invibe.web.restat some point, too (it's necessary for supporting member functions for@before). Look forcomputeAttributedParameterCtxinvibe.web.webto get to the place where the parameter is set.