Idea: let's use ctx.data to represent the databag inside routes and helpers. This is especially convenient in helpers where values might come from req.query or req.body (when using bodyDecoder) depending on the calling environment (get vs post). In routes @data would allow for pre-0.3-like semantics (= more direct migration strategy).
Suggested changes:
line 265
if app.settings['databag']
args[1].params = ctx.data
line 287
if app.settings['databag']
ctx.data = {}
copy_data_to ctx.data, [req.query, req.params, req.body]
line 292
switch app.settings['databag']
when 'this' then result = r.handler.apply(ctx.data, [ctx])
when 'param' then result = r.handler.apply(ctx, [ctx.data])
else result = r.handler.apply(ctx, [ctx])
Idea: let's use
ctx.data
to represent the databag inside routes and helpers. This is especially convenient in helpers where values might come fromreq.query
orreq.body
(when usingbodyDecoder
) depending on the calling environment (get
vspost
). In routes@data
would allow for pre-0.3-like semantics (= more direct migration strategy).Suggested changes: line 265
line 287
line 292