mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 01:47:35 +00:00
refactor(rest) onFS{Get, Put, Delete}
This commit is contained in:
parent
b0b6fc396d
commit
82de5d4ef2
1 changed files with 11 additions and 6 deletions
|
|
@ -28,9 +28,14 @@
|
|||
CloudFunc = require(DIR_LIB + 'cloudfunc'),
|
||||
format = require(DIR_LIB + 'format'),
|
||||
|
||||
onFSGet = require(DIR + 'rest/fs/get'),
|
||||
onFSPut = require(DIR + 'rest/fs/put'),
|
||||
onDelete = require(DIR + 'rest/fs/delete'),
|
||||
Fs = [
|
||||
'get',
|
||||
'put',
|
||||
'delete'
|
||||
].map(function(name) {
|
||||
return require(DIR + 'rest/fs/' + name);
|
||||
}),
|
||||
|
||||
markdown = require(DIR + 'rest/markdown'),
|
||||
|
||||
auth = require(DIR + 'auth'),
|
||||
|
|
@ -142,13 +147,13 @@
|
|||
|
||||
switch (p.request.method) {
|
||||
case 'PUT':
|
||||
onFSPut(query, path, p.request, function(error, data) {
|
||||
Fs.put(query, path, p.request, function(error, data) {
|
||||
callback(error, optionsDefauls, data);
|
||||
});
|
||||
break;
|
||||
|
||||
case 'GET':
|
||||
onFSGet(query, path, function(error, data) {
|
||||
Fs.get(query, path, function(error, data) {
|
||||
var str,
|
||||
options = {},
|
||||
isFile = error && error.code === 'ENOTDIR',
|
||||
|
|
@ -198,7 +203,7 @@
|
|||
else {
|
||||
files = Util.parseJSON(body);
|
||||
|
||||
onDelete(query, path, files, function(error) {
|
||||
Fs.delete(query, path, files, function(error) {
|
||||
var names, msg;
|
||||
|
||||
if (!error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue