title: NodeJS 4 with Express does not send request to the server with get/post
body: <p><a href="https://stackoverflow.com/questions/60125125/take-json-string-from-esp8266wifi-and-save-it-as-a-string-variable-in-nodejs-to">Branching from the project of mine from old question.</a></p>
  
  <p>I am trying to write NodeJS with Express to read the value of ip address on port <code>9999</code>, and the internet is from the wifi hotspot sharing of my own computer, so I wrote a code like this.</p>
  
  <pre><code>var express = require('express');
  var bodyParser = require('body-parser');
  var app = express();
  var cors = require('cors');
  var dateToday = new Date();
  var yearToday = dateToday.getFullYear();
  var sensor_name                  = "living-room";
  var hist_temperature_file_path   = "sensor-values/temperature_" + sensor_name + "_log_" + yearToday.toString() + ".csv";
  var latest_temperature_file_path = "sensor-values/temperature_" + sensor_name + "_latest_value.csv";
  var hist_humidity_file_path      = "sensor-values/humidity_" + sensor_name + "_log_" + yearToday.toString() + ".csv";
  var latest_humidity_file_path    = "sensor-values/humidity_" + sensor_name + "_latest_value.csv";
  var csv_header_temperature       = "timestamp,temperature_in_celsius\n";
  var csv_header_humidity          = "timestamp,relative_humidity\n";
  var sec_between_log_entries      = 60;
  var latest_humidity              = 0.0;
  var latest_temperature           = 0.0;
  var latest_value_datetime;
  var dateTime = new Date().toISOString().replace('T', ' ').substr(0, 19);
  const fetch = require('node-fetch');
  var ipAddress;
  
  app.use(cors());
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({extended: true}));
  /*app.use(function (req, res) {
    res.setHeader('Content-Type', 'application/json');
  })*/
  app.set('port', (process.env.PORT || 9999));
  //app.set('trust proxy', true)
  
  /*app.get('/temperature_humidity', function (req, res) {
    console.log('test1')
    latest_temperature = req.body.temperature;
    latest_humidity = req.body.humidity;
      console.log(latest_temperature)
    console.log(latest_temperature)
      res.send('success : ' + req.body.temperature + ',' + req.body.humidity)
  })*/
  
  app.get('/', function (req, res) {
    ipAddress = req.ip;
    console.log(req.ip);
  })
  
  fetch('http://' + ipAddress + '/temperature_humidity')
    .then(response =&gt; response.json())
    .then(data =&gt; {
      console.log(data);
    })
  
  app.listen(app.get('port'), function () {
    console.log('run at port', app.get('port'));
  })
  </code></pre>
  
  <p>But when I ran the code with the method <code>app.get</code> or <code>app.post</code>, the side of server does not show any request or response in the log, indicating no request have been sended to the server. But the terminal of NodeJS still shows <code>run at port 9999</code>, and no other <code>app.</code> log showing</p>
  
  <p><a href="https://i.stack.imgur.com/4hqYf.png" rel="nofollow noreferrer">The terminal log</a></p>
  
  <p>Can you show me how to fix this problem?</p>
  
  <p>P.S. The reason of <code>fetch</code> part was actually from how I cannot use <code>get/post</code>, so I use the <code>fetch</code> with fixed ip Address as placeholder for a while.</p>
  
  <p>edit: This is the code I want to use for getting value in the first place, but it doesn't show request being sended or value being received.</p>
  
  <pre><code>app.get('/temperature_humidity', function (req, res) {
    console.log('test1')
    latest_temperature = req.body.temperature;
    latest_humidity = req.body.humidity;
      console.log(latest_temperature)
    console.log(latest_temperature)
      res.send('success : ' + req.body.temperature + ',' + req.body.humidity)
  })
  </code></pre>