From 022b7f71a6c2c700960ce0769699c33780260e9c Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 15 Nov 2012 07:30:06 -0500 Subject: [PATCH] minor changes --- cloudcmd.js | 2 +- lib/server/rest.js | 9 +++++++-- server.js | 12 ++++++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/cloudcmd.js b/cloudcmd.js index a8039787..3ee4d743 100644 --- a/cloudcmd.js +++ b/cloudcmd.js @@ -85,7 +85,7 @@ */ function rest(pConnectionData){ console.log('rest'); - Util.exec(main.rest, pConnectionData); + return Util.exec(main.rest, pConnectionData); } function readConfig(){ diff --git a/lib/server/rest.js b/lib/server/rest.js index 2b49f909..65e53654 100644 --- a/lib/server/rest.js +++ b/lib/server/rest.js @@ -14,7 +14,8 @@ * @pConnectionData {request, responce} */ exports.rest = function(pConnectionData){ - var lReq = pConnectionData.request, + var lRet = false, + lReq = pConnectionData.request, lRes = pConnectionData.response, lUrl = lReq.url, lMethod = lReq.method; @@ -22,8 +23,12 @@ console.log(lUrl); console.log(lMethod); - if( Util.isContainStr(lUrl, APIURL) ) + if( Util.isContainStr(lUrl, APIURL) ){ console.log('api !!!!!!!!!!!! '); + return true; + } + + return lRet; /* switch(req.method){ case 'GET': diff --git a/server.js b/server.js index 99098c4e..e61d143c 100644 --- a/server.js +++ b/server.js @@ -299,19 +299,23 @@ CloudServer._controller = function(pReq, pRes) lFS_s = CloudFunc.FS; console.log("request for " + pathname + " received..."); - - if( lConfig.rest ) - Util.exec(CloudServer.rest, { + + if( lConfig.rest ){ + var lRestWas = Util.exec(CloudServer.rest, { request : pReq, response : pRes }); + + if(lRestWas) + return; + } /* если в пути нет информации ни о ФС, * ни об отсутствии js, * ни о том, что это корневой * каталог - загружаем файлы проэкта */ - else if ( !Util.isContainStr(pathname, lFS_s) && + if ( !Util.isContainStr(pathname, lFS_s) && !Util.isContainStr(pathname, lNoJS_s) && !Util.strCmp(pathname, '/') && !Util.strCmp(lQuery, 'json') ) {