strongloop/loopback — pull request #151 by bajtos (2014-01-21 16:15:00+00:00)
Title: Improve remoting metadata: register exported models using singular names

The first commit is just a cleanup that was made possible by strongloop/strong-remoting#37.

The second change is the purpose of this pull request:

> Remove the inconsistency between model names used by LoopBack app and
datasource-juggler (modelName, e.g. User) and the name used by
strong-remoting (pluralModelName, e.g. Users).

> This way the class name in the strong-remoting metadata can be used
by client-code generators. Before this change, the generators would
produce method names like `Users.login`.

**Important note**

This patch is introducing several incompatibilities with previous versions:

1. Shared models are no longer exported using plural names. Any code expecting plural keys in `app.remotes().exports` will no longer work.

2. `app.remoteObjects()` uses singular names for the keys. Any code expecting plural keys will no longer work.

3. Since remoting hooks are using class name, any code bypassing `ModelClass.beforeRemote/afterRemote` and registering hooks direcly via `app.remotes().before/after` will no longer works.

Code using the keys of `app.remotes().exports` or `app.remoteObjects()` to build remotable method names (e.g. `key + '.create'` will continue to work.

/to: @ritch or @raymondfeng please review

To follow semver rules, we should release this change as LoopBack 2.0. Any objections?