title: How to connect my mobile app (written in lua) and my server (written in node.js)?
body: <p>I am new to lua and node js and I am trying to connect the mobile app that I'm working on to the server. The problem is it connects to the server but the data that I am trying to pass gets lost or it doesn't reach the server.
  Any ideas on what's wrong with what I'm doing?</p>
  
  <p><a href="http://i.stack.imgur.com/VNXrA.png" rel="nofollow">this is my lua code to connect to the server</a></p>
  
  <pre><code>local function store ()
  
      local headers = {}
  
      headers["Content-Type"] = "application/x-www-form-urlencoded"
      headers["Accept-Language"] = "en-US"
  
      local body = "fname="..fname
      local params = {}
  
      params.headers = headers
      params.body = body
  
      print(body)
      print(headers)
      print(params.body)
      print(params.headers)
  
      network.request( "http://192.168.56.2:8888", "POST", networkListener, params )
  
  end
  
  
  
  local function networkListener( event )
          if ( event.isError ) then
          print( "Network error!")
      else
          print ( "RESPONSE: " .. event.response )
          local serializedString = json.decode( event.response )
  
                              print(serializedString)
  
          --data = json.decode(serializedString)
          --print(serializedString.student[1])
  
      end
  end
  </code></pre>
  
  <p>`</p>
  
  <p><a href="http://i.stack.imgur.com/huXkY.png" rel="nofollow">This is the code for the simple server I am trying to send a request to</a></p>
  
  <pre><code>var express = require('express');
  var app = express();
  
  var morgan = require('morgan');
  var consolidate = require('consolidate');
  var bodyparser = require('body-parser');
  var parser = require('luaparse');
  
  ////////////////////////////////////////////////////////////////////////////////
  
  app.listen(8888,function() {console.log('Server Running!');});
  
  ////////////////////////////////////////////////////////////////////////////////
  
  app.set('views', __dirname + '/views');
  app.engine('html', consolidate.nunjucks);
  app.use(morgan('dev'));
  app.use(bodyparser.urlencoded({ extended: true }));
  app.use('/static', express.static(__dirname + '/static'));
  
  ////////////////////////////////////////////////////////////////////////////////
  
  app.get('/', function(req, res) {
    res.render('index.html');
  });
  
  app.post('/', function(req, res) {
      var fname = req.fname;
      var lname = req.body.lastname;
  
      console.log("it went in");
      console.log(req.body.fname);
      console.log(req.body);
      console.log(req.header);
      console.log("nahuman");
  
  
    res.render('index.html');
   });
  
  ////////////////////////////////////////////////////////////////////////////////
  </code></pre>