Standardise API error response format

This commit is contained in:
Nick O'Leary
2015-03-30 14:16:04 +01:00
parent 7adefd6ee0
commit 2a8a885271
9 changed files with 24 additions and 26 deletions

View File

@@ -57,7 +57,7 @@ function createLibrary(type) {
res.send(403);
return;
}
res.send(500);
res.json(500,{message:err.toString()});
});
});
}
@@ -75,6 +75,7 @@ module.exports = {
},
get: function(req,res) {
storage.getFlow(req.params[0]).then(function(data) {
// data is already a JSON string
res.set('Content-Type', 'application/json');
res.send(data);
}).otherwise(function(err) {