1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Revert removal of flow storage api

Whilst we know with the file system storage inplementation
getLibraryEntry is a suitable replacement for getFlow, this
may not be the case with other implementations.

The storage code uses the deprecated functions if they are
present - so the core code should call them and let the storage
layer decide what it calls.
This commit is contained in:
Nick O'Leary 2015-04-05 20:54:11 +01:00
parent 5be3472413
commit 5efbdf5d04

View File

@ -74,7 +74,7 @@ module.exports = {
}); });
}, },
get: function(req,res) { get: function(req,res) {
storage.getLibraryEntry("flows",req.params[0]).then(function(data) { storage.getFlow(req.params[0]).then(function(data) {
// data is already a JSON string // data is already a JSON string
res.set('Content-Type', 'application/json'); res.set('Content-Type', 'application/json');
res.send(data); res.send(data);
@ -91,7 +91,7 @@ module.exports = {
}, },
post: function(req,res) { post: function(req,res) {
var flow = JSON.stringify(req.body); var flow = JSON.stringify(req.body);
storage.saveLibraryEntry("flows",req.params[0],{},flow).then(function() { storage.saveFlow(req.params[0],flow).then(function() {
res.send(204); res.send(204);
}).otherwise(function(err) { }).otherwise(function(err) {
log.warn("Error loading flow '"+req.params[0]+"' : "+err); log.warn("Error loading flow '"+req.params[0]+"' : "+err);