mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
#12 added featureDb which recieves events feature-events and should update projection
This commit is contained in:
parent
6f81468cb7
commit
8033a231e4
@ -1,6 +1,5 @@
|
||||
var Promise = require('bluebird');
|
||||
var featuresMock = require('./featuresMock');
|
||||
// var dbPool = require('./dbPool');
|
||||
|
||||
function getFeature(name) {
|
||||
var featureFound;
|
||||
|
@ -1,11 +1,12 @@
|
||||
var db = require('./db'),
|
||||
eventStore = require('./eventStore'),
|
||||
eventType = require('./eventType');
|
||||
eventType = require('./eventType'),
|
||||
featureDb = require('./featureDb');
|
||||
|
||||
module.exports = function (app) {
|
||||
|
||||
app.get('/features', function (req, res) {
|
||||
db.getFeatures().then(function (features) {
|
||||
featureDb.getFeatures().then(function (features) {
|
||||
res.json({features: features});
|
||||
});
|
||||
});
|
||||
|
18
unleash-server/lib/featureDb.js
Normal file
18
unleash-server/lib/featureDb.js
Normal file
@ -0,0 +1,18 @@
|
||||
var eventStore = require('./eventStore'),
|
||||
eventType = require('./eventType'),
|
||||
featuresMock = require('./featuresMock'),
|
||||
Promise = require('bluebird');
|
||||
|
||||
eventStore.on(eventType.featureCreated, function (event) {
|
||||
console.log('feature created event recieved', event);
|
||||
}
|
||||
);
|
||||
|
||||
function getFeatures() {
|
||||
return Promise.resolve(featuresMock);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getFeatures: getFeatures
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user