title: how to send Post request from express.js to another server ( java)?
body: <p>I have to send data (json object) to another webserver (java).</p>
  
  <p>This is my node.js code </p>
  
  <pre><code>var express = require('express');
  
  var app = express();
  
  app.get('/', function (req, res) {
      var data = querystring.stringify({
          username: "myname",
          password: " pass"
      });
  
      var options = {
          host: 'www.javaserver.com',
          port: 8070,
          path: '/login',
          method: 'POST',
          headers: {
              'Content-Type': 'application/x-www-form-urlencoded',
              'Content-Length': Buffer.byteLength(data)
          }
      };
  
      var req = http.request(options, function (res) {
          res.setEncoding('utf8');
          res.on('data', function (chunk) {
              console.log("body: " + chunk);
          });
      });
      req.write(data);
      req.end();
  
  });
  
  app.listen(8090);
  </code></pre>
  
  <p>This is not working. How can I do this?</p>