From 1242a0e26b4d3d71b15f161f044e4afa83b9db49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olof=20=C3=85strand?= Date: Tue, 19 Dec 2017 17:12:54 +0100 Subject: [PATCH] Fixed db2 example, recid should be LOWER --- server/node/db2/readme.md | 6 ++---- server/node/db2/w2ui.js | 13 ++++++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/server/node/db2/readme.md b/server/node/db2/readme.md index b340e60b9..6578fc806 100644 --- a/server/node/db2/readme.md +++ b/server/node/db2/readme.md @@ -8,7 +8,7 @@ The example uses Users and positions to demonstrate Note that a user can only be at one posision, but there might be posisions without locataions The example is not yet finnished but can serve as a starting point and example. -I have tried to reuse and look at the postgress node implementation foud here, +I have tried to reuse and look at the postgress node implementation found here, http://w2ui.com/kickstart/ ## Installation @@ -19,7 +19,7 @@ To run the server with example client public/index.html npm install -node server.js +node start.js http://localhost:8080 @@ -49,7 +49,5 @@ In the top part you can generate users and later use them in the When you have entered some data you can test the api with, -http://localhost:8080/api/enum/position - http://localhost:8080/api/enum/user diff --git a/server/node/db2/w2ui.js b/server/node/db2/w2ui.js index a5bf5cb73..3c6f4f2f6 100644 --- a/server/node/db2/w2ui.js +++ b/server/node/db2/w2ui.js @@ -1,5 +1,5 @@ /** -* Module that helps wo work with W2UI +* Module that helps to work with W2UI & db2 * * DEPENDENCIES: underscore */ @@ -201,8 +201,6 @@ function serveDB2(req, res, collectionName) var val = obj[key]; fields.push(key); values.push(val); - // use val - console.log("Olle", key, val); }); sql = sql + '(' ; @@ -249,8 +247,8 @@ function serveDB2(req, res, collectionName) break; default: { - console.log("Unknown cmd",evaluated.cmd) - var err_response = { + console.log("Unknown cmd",evaluated.cmd) + var err_response = { status: "error", message: "Command not recognized" }; @@ -461,6 +459,11 @@ function getRecords (sql, req, res, options) { if (master == null) master = record[options.master]; delete record[options.master]; } + if (record.RECID) { + record.recid = record.RECID + delete record.RECID; + console.log(record.recid) + } data.push(record); } var ret = {