Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
LoopBack 3 with Mixins as First Class Citizens

LoopBack 3

Core + Boot + Connector refactor

0. setup

  • all components loaded into registry
  • all mixins loaded into registry
  • registry mixins applied
  • create models, apply model configs, etc
  • create data sources
// applying registry mixins
registryMixins.forEach(function(registryMixin) {
  // loading data sources, models, etc will be implemented as mixins

1. base mixins

var baseMixin = registry.getMixin(ModelCtor.settings.base);

// these mixins may apply other mixins
// eg. PersistedModelMixin would cobble together
// - DataAccess
// - Validation
// - Find

2. ds mixins

var dsMixin = registry.getMixin(ModelCtor.settings.dataSource);

3. user defined mixins


4. global user defined mixins

registry.globalMixins.forEach(function(mixinDesc) {
  if (mixinDesc.shouldBeAppliedTo(ModelCtor)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.