Data aggregation framework.
npm install logic
var logic = require('logic');
Clone repository, then
npm install npm test
Logic helps you to define relationships between different data sources and combine it into the one solid responce. It knows nothing about how this data sources work.
There are two types of logics:
- provider based logic, which leads to some data
- abstract logic, which is used to organise other logics (abstract or provider based)
Abstract logic declaration
Provider must decide if it will process logic with a given name, params and options or not. If so it should return function, or anything else otherwice (undefined or null is better). You can add as many providers, as you want, but only first match will be executed.
logic knows nothing about how provider works, it can be HTTP request, DB query, memory cache, etc. The only rule: provider function should return A+ promise.
Now in your API you can use just a single call, and
logic will take care about all the dependencies.