1
0
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:
svelovla 2014-10-23 09:50:23 +02:00 committed by Ivar Conradi Østhus
parent 6f81468cb7
commit 8033a231e4
3 changed files with 21 additions and 3 deletions

View File

@ -1,6 +1,5 @@
var Promise = require('bluebird');
var featuresMock = require('./featuresMock');
// var dbPool = require('./dbPool');
function getFeature(name) {
var featureFound;

View File

@ -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});
});
});

View 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
};