8000 Service method call normalization by daffl · Pull Request #124 · feathersjs/feathers · GitHub
[go: up one dir, main page]

Skip to content

Service method call normalization#124

Merged
daffl merged 2 commits intomasterfrom
normalizer-mixin
Mar 8, 2015
Merged

Service method call normalization#124
daffl merged 2 commits intomasterfrom
normalizer-mixin

Conversation

@daffl
Copy link
Member
@daffl daffl commented Mar 7, 2015

#123 added method normalization to Socket calls. As discussed, this pull request instead adds a mixin that always normalizes all method calls. It will always be added as the last mixin (and therefore the first to run) which also makes sure that plugins like feathers-hooks won't have to worry about normalizing the parameters.

@daffl
Copy link
8000
Member Author
daffl commented Mar 7, 2015

This means you can now always do things like:

app.use('/todos', {
  update: function(id, data, params, callback) {
    callback({
      id: id,
      data: data,
      params: params
    })
  }
});

var todoService = app.service('todos');

// Call `update` with just id, callback and data
todoService.update(10, { type: 'new data' }, function() {});

// Call `update` with just id and data
app.service('todos').update(10, { type: 'new data' });

@daffl daffl mentioned this pull request Mar 7, 2015
daffl added a commit that referenced this pull request Mar 8, 2015
Service method call normalization
@daffl daffl merged commit 1a0a55a into master Mar 8, 2015
@daffl daffl deleted the normalizer-mixin branch March 8, 2015 17:22
daffl added a commit that referenced this pull request Aug 24, 2018
* Add upgrade functionality

* Add @feathersjs/tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment < 5A30 /div>

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0