Backend Services
An Indepth guides of the CleverStack NodeJS Backend, covering installation, configuration, usage, extending, testing and much more.
An Indepth guides of the CleverStack NodeJS Backend, covering installation, configuration, usage, extending, testing and much more.
CleverStack's Service Layer makes a clear distiction between web (controller) activity that is best handled in the controller and general business related logic that is not web related - this separation also gives us the ability to do testing on the business logic of the Service either on it's own (unit test) or with the web related logic from the Controller/s (e2e test)
Good code is short, simple, and symmetrical – the challenge is figuring out how to get there.
A Service should take advantage of our Dependency Injection and load whatever Model is used to actually store the data, by defining the Model in the Class of the Service you are able to enable the Controller to automatically give you CRUD routing and actions.
When defining methods in services that require other models the correct way of working with those other models is to use their Service, this mean's that services business logic can still be run (transactions, their own transactions, etc)
Using a Service Layer also mean's that you can store data in whatever you want not just the ORM or ODM models that CleverStack provides, and you can even easily change the underlying storage of an existing Service because of this Pattern.
This section of the documentation is either out-dated or incomplete, please ask for help in github or hipchat if you need more information.
module.exports = function ( Service, ExampleModel ) {
return Service.extend({
model: ExampleModel
});
};
This section of the documentation is either out-dated or incomplete, please ask for help in github or gitter if you need more information.
This section of the documentation is either out-dated or incomplete, please ask for help in github or gitter if you need more information.
This section of the documentation is either out-dated or incomplete, please ask for help in github or gitter if you need more information.
This section of the documentation is either out-dated or incomplete, please ask for help in github or gitter if you need more information.