Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ctx.data in routes and helpers (0.3.0) #91

Open
shimaore opened this Issue · 0 comments

1 participant

@shimaore

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])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.