strongloop/loopback-example-full-stack — pull request #28 by bajtos (2014-06-12 15:03:46+00:00)
Title: Rework `models` to use the new 2.0 layout, extract `lbclient/`

/to @ritch please review.

The first commit closes #13.

The rest is preparing the project to drop `html5` and scaffold it using `generator-angular` as discussed in #17. More changes will be coming later.

---

Note: the proposal in #13 was describing a structure where model files were nested as `models/lib/*.js` to make `models/` look like a package. As I was thinking about this structure, and also taking into account the alternate layout proposed by @kraman, I decided to keep the structure `models/*.js`.

If we wanted to package a set of models into a standalone npm package, I would propose to keep the model files in `models/*`. That way the project structure remains same for all project types: model package, api server and full-stack app. It can be used by plugins like `loopback-passport` too.

When it comes to optimisation of the size of the browserified bundle, one can write `require('common/models/my-model.js')` to explicitly require individual models. This is IMO nicer than `require('common/models/lib/my-model.js')`.

Anyway, the ability to package models is out of scope of this pull request. It is not making the situation any worse than it is now and we can always change the layout of model files later.