Abstract underlying Racer model API with a more convenient API/DSL which takes care of much of the underlying complexity of setting paths etc.
The main idea is that Pipes and Resources encapsulate the following key entities:
Pipe
- encapsulate the underlying path in the store (model)
- is connected to a resource
Resource
- wraps the Racer model API
- encapsulates the value of a node in the model
- uses its pipe to know its current path in the model
Each pipe is connected to a resource.
See Pipe Design
A resource will get the model path for where to sync its value from its pipe.
- CollectionResource, such as
users
, that can expect the instances it contains to all be of a certain "Class" - ModelResource, such as 'user', that is an instance of a "Class" and is contained by a CollectionResource
- AttributeResource that can access the attribute of a ModelResource
See Resource Design
Any model store operation is categorized as either a Read, Update or Delete (RUD) command. Depending on the type of command, a different Middleware stack is applied (injected) as part of the operation.
- Read - authorize, decorate
- Update - authorize, validate, (container validate?), marshal
- Delete - authorize, (container validate?)
See Mw design
Better overview:
Other links:
- derby-model
- racer-example
- middleware - engine for Middleware
Design architecture for leveraging subscriptions and live updates (promises?) (bacon.js?)
- subscriptions to model change events ;)
Please :) Any help is greatly appreciated!
Just use mocha
$ mocha
Run particular test
$ mocha test/racer-mw/crud_test.js
Easy :)
MIT Copyright 2014 Kristian Mandrup