title: In React Redux-Saga Express Nodejs environment, req.body is undefined in router
body: <p>I have read through other examples of req.body returning undefined on StackOverflow, but have not come across any solutions proposed before that have solved my problem.</p>
  
  <p>I am working in React Express Node.js environment. I have other GET requests to the server that are working, however I have one GET request that returns "undefined" when I log out "req.body" from the router. </p>
  
  <p>My Express server is configured like so: </p>
  
  <pre><code>const express = require("express");
  require("dotenv").config();
  
  const app = express();
  const bodyParser = require("body-parser");
  const sessionMiddleware = require("./modules/session-middleware");
  
  const passport = require("./strategies/user.strategy");
  
  // Body parser middleware
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: true }));
  
  // Route includes
  const userRouter = require("./routes/user.router");
  const bucketRouter = require("./routes/bucket.router");
  const UploaderS3Router = require("react-dropzone-s3-uploader/s3router");
  const imageRouter = require("./routes/image.router");
  
  // Passport Session Configuration //
  app.use(sessionMiddleware);
  
  // start up passport sessions
  app.use(passport.initialize());
  app.use(passport.session());
  
  /* Routes */
  app.use("/api/user", userRouter);
  app.use("/api/user", bucketRouter);
  app.use("/api/imageurl", imageRouter);
  
  //aws route
  app.use(
    "/s3",
    UploaderS3Router({
      bucket: "annesbucket", // required
      region: "us-east-2", // optional
      headers: { "Access-Control-Allow-Origin": "*" }, // optional
      ACL: "public-read", // this is the default - set to `public-read` to let anyone view uploads
    })
  );
  
  // Serve static files
  app.use(express.static("build"));
  
  // App Set //
  const PORT = process.env.PORT || 5000;
  
  /** Listen * */
  app.listen(PORT, () =&gt; {
    console.log(`Listening on port: ${PORT}`);
  });
  </code></pre>
  
  <p>I am using redux saga to make the GET request and to pass the payload from the req.body to the server, and it looks like this:</p>
  
  <pre><code>import axios from "axios";
  import { put, takeLatest } from "redux-saga/effects";
  
  function* getPhotosExperiences(action) {
    try {
      const userID = action.payload.userID;
  
      const config = {
        headers: { "Content-Type": "application/json" },
        withCredentials: true,
      };
      const response = yield axios.get(
        `/api/imageurl/photoexperience/${userID}`,
        action.payload
        //   config
      );
      console.log(action.payload);
      yield put({
        type: "SET_PHOTOS_EXPERIENCES",
        payload: response.data,
      });
      console.log(response.data);
    } catch (err) {
      console.log("error getting list items:", err);
    }
  }
  
  function* getPhotosExperiencesSaga() {
    yield takeLatest("GET_PHOTOS_EXPERIENCES", getPhotosExperiences);
    console.log("getPhotosExperiences fired off");
  }
  
  export default getPhotosExperiencesSaga;
  </code></pre>
  
  <p>Again, when I log out "action.payload" in my saga I'm seeing the data that I want to pass to the server.</p>
  
  <p>The GET request that is not recognizing req.body is in a router that is registered in the server as imageRouter.</p>
  
  <p>This is my GET request:</p>
  
  <pre><code>router.get("/photoexperience/:userID", rejectUnauthenticated, (req, res) =&gt; {
    console.log(
      "this is what the server is getting:",
      req.body.userID,
      req.body.experienceID
    );
    console.log("req.params.id is:", req.params.id);
    console.log("this is req:", req);
    const experienceID = req.body.experienceID;
    const queryText = `SELECT "user_photos_experiences".experience_id, "user_photos_experiences".photo_id, "photos".experience_photo
    FROM "user_photos_experiences"
     JOIN "photos" ON "user_photos_experiences".photo_id = "photos".id WHERE "user_photos_experiences".experience_id = $1`;
    pool
      .query(queryText, [experienceID])
      .then((responseDB) =&gt; {
        const dbRows = responseDB.rows;
        console.table(dbRows);
        res.send(dbRows);
      })
      .catch((err) =&gt; {
        console.log("error getting photos from photoexperience:", err);
        res.sendStatus(500);
      });
  }); 
  </code></pre>
  
  <p>I'd appreciate another set of eyes on this -- it's been stumping me for many hours!</p>
  
  <p>TLDR; I am wondering how I can access the payload I sent out from my saga from within my server side router.</p>