Skip to content

Commit

Permalink
DELETE completed
Browse files Browse the repository at this point in the history
  • Loading branch information
ksafranski committed Jun 18, 2013
1 parent 59612b2 commit 9f7281d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion server.js
Expand Up @@ -134,7 +134,8 @@ var resError = function (code, raw, res) {
104: 'Could not create copy',
105: 'File does not exist',
106: 'Not a file',
107: 'Could not write to file'
107: 'Could not write to file',
108: 'Could not delete object'
};

res.send({ "status": "error", "code": code, "message": codes[code], "raw": raw });
Expand Down Expand Up @@ -425,6 +426,20 @@ server.del(pathRegEx, function (req, res, next) {
// Set path
var path = config.base + '/' + req.params[1];

// Make sure it exists
if (fs.existsSync(path)) {
// Remove file or directory
fs.remove(path, function (err) {
if (err) {
resError(108, err, res);
} else {
resSuccess(null, res);
}
});
} else {
resError(103, null, res);
}

});

/**
Expand Down

0 comments on commit 9f7281d

Please sign in to comment.