title: express node.js making a get request to another server from node route
body: <p>So the client makes a get request using a button on the index page. This sends some information to a route which has been set up as follows:</p>
  
  <p>app.js </p>
  
  <pre><code>var route = require('./routes/index');
  var button = require('./routes/button');
  app.use('/', index);
  app.use('/button', button);
  </code></pre>
  
  <p>The request is sent from a client-side directory to the node framework whenever someone presses the button. If the request is sent to 'localhost:port/button', then the button.js file mentioned above will receive the request. So in the button.js file we have something like the following:</p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  var someData = '';
  
  router.get('/', function (req, res, next) {
      //make a get request here such that someData
      //receives whatever the request returns from another
      //set up framework(i.e. Spring...)
      someData = getRequest('some other URL');
      res.send(someData);
  };
  module.exports = router;
  </code></pre>
  
  <p>The problem here is that the getRequest('some other URL') within the router get request never receives any information. </p>
  
  <p>Also (as a side-note), I cannot seem to find in the express API as to why we have</p>
  
  <pre><code>router.get('/')...
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>router.get('/button')...
  </code></pre>
  
  <p>to access and make requests to the button page. </p>
  
  <p>Any help would be very much appreciated!</p>