From c1ee6134d8f7f22a8d227c34fe3e5d6817fca936 Mon Sep 17 00:00:00 2001 From: Trowbridge Date: Wed, 13 Mar 2019 13:24:34 -0400 Subject: [PATCH] reorder --- index.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 70414ac..05477ad 100644 --- a/index.js +++ b/index.js @@ -127,12 +127,21 @@ server.post('/addmonth_v', bodyParser.json(), function (req, res) { var d = 1; //counts cycles in scenario key values which are arrays var args = []; var path = './route_sql/addmonth_vd.sql'; + + fs.readFile(path, 'utf8', function(err, data){ + if (!err){ + callback(data); + } else { + console.log("fatal error pulling sql file") + callback(err); + } + }); var callback = function(arg){ sql = arg; //buile where clause expression ({ c, w, d } = build_where(req, c, w, d, args)); - + if (c == 1) { res.send("no body was sent"); return; @@ -151,15 +160,6 @@ server.post('/addmonth_v', bodyParser.json(), function (req, res) { console.log(sql) Postgres.FirstRow(sql,[],res) } - - fs.readFile(path, 'utf8', function(err, data){ - if (!err){ - callback(data); - } else { - console.log("fatal error pulling sql file") - callback(err); - } - }); }) server.post('/addmonth_vp', bodyParser.json(), function (req, res) {