From 2942d4dc05d3058d3f4ebb02051ee4afddd872cb Mon Sep 17 00:00:00 2001 From: Ivan Socolsky Date: Thu, 14 May 2015 12:43:12 -0300 Subject: [PATCH] add endpoint for preferences --- lib/expressapp.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/expressapp.js b/lib/expressapp.js index aa50e93..01a1c6b 100644 --- a/lib/expressapp.js +++ b/lib/expressapp.js @@ -193,6 +193,23 @@ ExpressApp.prototype.start = function(opts, cb) { }); }); + router.get('/v1/preferences/', function(req, res) { + getServerWithAuth(req, res, function(server) { + server.getPreferences({}, function(err, preferences) { + if (err) return returnError(err, res, req); + res.json(preferences); + }); + }); + }); + + router.put('/v1/preferences', function(req, res) { + getServerWithAuth(req, res, function(server) { + server.savePreferences(req.body, function(err, result) { + if (err) return returnError(err, res, req); + res.json(result); + }); + }); + }); router.get('/v1/txproposals/', function(req, res) { getServerWithAuth(req, res, function(server) {