From 2cf35bd8f4ed2453b3622a9bbd548256911bc907 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 17 Oct 2014 09:18:01 -0400 Subject: [PATCH] refactor(config) config.serve -> config() --- lib/cloudcmd.js | 2 +- lib/server/config.js | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/cloudcmd.js b/lib/cloudcmd.js index 43cd59c1..d5c93c76 100644 --- a/lib/cloudcmd.js +++ b/lib/cloudcmd.js @@ -77,7 +77,7 @@ funcs = [ authFunc, - config.serve, + config(), rest, route, diff --git a/lib/server/config.js b/lib/server/config.js index 0d21f5c8..b6972cc5 100644 --- a/lib/server/config.js +++ b/lib/server/config.js @@ -31,15 +31,17 @@ module.exports = set; module.exports.save = save; - module.exports.serve = serve; function set(key, value) { var result; - if (value === undefined) - result = config[key]; + if (key) + if (value === undefined) + result = config[key]; + else + config[key] = value; else - config[key] = value; + result = middle; return result; } @@ -57,8 +59,7 @@ }); } - function serve(req, res, next) { - console.log(req.url) + function middle(req, res, next) { if (req.url !== apiURL + '/config') { next(); } else {