title: Axios request within /POST request on Express
body: <p>As you can see below, in my server.js file I have a /POST Info request that gets called on a form submittal.</p>
  
  <p>I started to get confused on reading about the different between app.post and express routes and if in anyway using routes would benefit my code here.</p>
  
  <p>Within the /POST Info I have two axios requests to 2 different APIs and I think it would be wise to move the code elsewhere to make it cleaner.</p>
  
  <p>Would knowing how routes work here benefit me anyway?And if you can explain the difference here that would be great.</p>
  
  <pre><code>app.post('/Info', function (req, res) {
     var State = req.body.State;
     var income = Number(req.body.income);
     var zip = req.body.ZIP;
     axios.post('https://taxee.io/api/v2/calculate/2017', {
        //data sent to Taxee.io
        "exemptions": 1
        , "filing_status": "single"
        , "pay_periods": 1
        , "pay_rate": income || 100000
        , "state": State || "NY"
     }, {
           headers: {
              'Authorization': "Bearer &lt;API_KEY&gt;"
              //headers
           }
     }).then(function (response) {
        var obj = {
          income: '$' + income
          , fica: response.data.annual.fica.amount
          , federal: response.data.annual.federal.amount
          , residence: State + ", " + zip
          , state: response.data.annual.state.amount
        }
        axios.get("https://www.quandl.com/api/v3/datasets/ZILL/Z" + zip + "_RMP.json?api_key=&lt;API_KEY&gt;").then(function (response) {
           var monthRent = response.data.dataset.data[0][1]
           obj.rent = monthRent
           obj.yearlyRent = Number(monthRent) * 12;
        }).then(function (response) {
           res.send(obj);
        });
    }).catch(function (error) {
        alert('error');
    });
  }
  </code></pre>