Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

97
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda