From 597754364fc88384f1b6c766fa6413a11f3ef0c6 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 25 Nov 2013 13:09:03 +0000 Subject: [PATCH] feature(server) add combine --- lib/server.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/server.js b/lib/server.js index bf93daaa..8b490c42 100644 --- a/lib/server.js +++ b/lib/server.js @@ -29,6 +29,7 @@ Util = main.util, express = main.express, expressApp = express.getApp(controller), + files = main.files, Server, Rest, Route; @@ -168,6 +169,9 @@ if (!lRet && Route) lRet = Util.exec(Route, lData); + if (!lRet) + lRet = combine(lPath, pRes); + if (!lRet) { lName = lData.name; @@ -200,6 +204,26 @@ } } + function combine(path, res) { + var names, + dir = DIR, + COMBINE = '/combine', + isCombine = Util.isContainStrAtBegin(path, COMBINE); + + if (isCombine) { + path = Util.removeStrOneTime(path, COMBINE); + names = path.split(':'); + console.log(names, DIR); + files.readPipe(names, dir, res, function(error) { + Util.log(error); + main.sendError(res); + }); + } + + return isCombine; + } + + exports.start = start; })();