add route to download backup

This commit is contained in:
Girish Ramakrishnan
2016-03-08 16:28:42 -08:00
parent a10ed73af2
commit 8014e2eaf8
2 changed files with 14 additions and 1 deletions
+13 -1
View File
@@ -4,7 +4,8 @@
exports = module.exports = {
get: get,
create: create
create: create,
download: download
};
var backups = require('../backups.js'),
@@ -39,3 +40,14 @@ function create(req, res, next) {
next(new HttpSuccess(202, {}));
});
}
function download(req, res, next) {
assert.strictEqual(typeof req.params.backupId, 'string');
backups.getRestoreUrl(req.params.backupId, function (error, result) {
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(200, result));
});
}