Error on sending table to backend
Hi all,
I am trying to use send table to URL feature using NodeJS. But there is an error coming
== Lua Error Totals ==
(4) - [string "engine"]:0: attempt to concatenate field 'response' (a nil value)
stack traceback:
[string "engine"]: in function 'sendTableCallback'
[string "engine"]: in function <[string "engine"]:0>
[string "engine"]: in function <[string "engine"]:0>
[string "engine"]: in function 'postEvent'
[string "engine"]: in function 'advanceTime'
[string "engine"]: in function 'evaluate'
[string "engine"]: in function ''
[string "engine"]: in function <[string "engine"]:0>
My server.js is as follows
`
var express = require('express');
var app = express();
//var path = require('path');
var port=3014;
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var __projectRoot = __dirname;
//app.use(express.static(__projectRoot));
var router = express.Router(); // get an instance of the express Router
bodyParser = require('body-parser');
// test route to make sure everything is working (accessed at GET http://localhost:8080/api)
app.use(bodyParser.urlencoded({
extended: true
}));
app.use(bodyParser.json());
app.get('/', function(req, res) {
res.send('im the home page!');
});
app.post('/savescore',function(req, res) {
console.log(req);
console.log('table received');
res.write(JSON.stringify({"Status":"Success"}));
res.end();
res.json('{"Status":"Success"}');
});
console.log('Server up and running on http://localhost:'+port);
app.listen(port);`
I could not figure out what the issues was.
Your help is really appreciated.
Thank You!
Amila