title: Axios Node.Js GET request with params is undefined
body: <p>I am running a react app with nodejs on backend. Whenever I make an axios call without parameters, everything works, but when I try to add paramaters and use them with req.body.variableName, it prints undefined. Printing req.body is just an empty curly brace so somehow my data is not being sent. </p>
  
  <p>React File with axios call</p>
  
  <pre><code>getFriendCount(){
      var data = {
          UserID: this.state.UserID,
      }
      console.log(data)
      axios.get("http://localhost:8081/getFriendCount", data).then((response)=&gt;{
          if (response.status &gt;= 400) {
              console.log(response.status);
              throw new Error("Bad response from server");
          } else{
              return response.data[0].friendCount
          }
      }).then((data)=&gt;{
          console.log(data)
          this.setState({count: data})
      })
  }
  </code></pre>
  
  <p>serversql.js</p>
  
  <pre><code>const HTTP_PORT = process.env.PORT || 8081;
  const express = require("express");
  const bodyParser = require('body-parser');
  const app = express();
  const urlencodedParser = bodyParser.urlencoded({ extended: false });
  const cors = require("cors");
  const mysql = require('mysql');
  
  app.use(cors());
  app.use(bodyParser.urlencoded({ extended: false }));
  app.use(bodyParser.json());
  
  const {addNewMemory,getAllMemories, getFriendCount} = require('./db-services.js');
  
  //Database connection...
  
  app.get('/data', getAllMemories);
  app.post('/addMemory',urlencodedParser,addNewMemory);
  app.get('/getFriendCount',urlencodedParser, getFriendCount);
  
  app.listen(HTTP_PORT, ()=&gt;{console.log("API listening on: " + HTTP_PORT)});
  </code></pre>
  
  <p>db-services.js (req.body.UserID is undefined)</p>
  
  <pre><code>module.exports={
    getFriendCount:(req,res) =&gt; {
      console.log(req.body)        //empty curly brace
      console.log(req.body.UserID) //undefined
      console.log(req.params)      //empty curly brace
      var sql = "SELECT COUNT(*) AS friendCount FROM friendship WHERE UserId1 = (?) OR UserId2 = (?)";
      var values = [req.body.UserID, req.body.UserID]
      dbconnection.query(sql, values, function(err,result,fields){
          if(err){
              return res.status(500).send(err);
          } else {
              res.send(result);
          }
      })
  },
  }
  </code></pre>