Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

106
Views
Formdata not being sent through to NodeJS backend

I have a function that should send FormData as an axios.post call to my api. It gets activated with a press of a button

  const sendCard = (card) => {
    debugger;
    let data = new FormData();
    data.append("itemID", itemID);
    data.append("comment", comment);
    data.append("dateStart", dates[0]);
    data.append("dateEnd", dates[1]);
    data.append("qtyWant", qtyWant);
    requestBooking(data);
  };

and here is the axios part:

export const requestBooking = async (data) => {
  return await api
    .post(`/booking/request`, data)
    .then((data) => {
      return "DONE!";
    })
    .catch((err) => {
      console.log(err.response.data);
    });
};

the api is an import from a config.js file, and everything there works with all the other aspects of my website.

I have another FormData object being posted into the api, and that one works properly, even though there is no differences at all...

Here is the accepting function on the back end

  app.post(
    "/api/booking/request",
    request
  );

exports.request = (req, res) => {
  res.status(200).send("Reached");
};

where req.body is just an empty object ({})

This all seems like it should work. And I don't know what am I missing

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!