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

175
Views
Node.js POST: req.body vacío

¡Nuevo backend aquí! Estoy tratando de publicar desde mi frontEnd js a Node, pero el cuerpo de la solicitud siempre está vacío. He leído toneladas de respuestas aquí, pero ninguna me ayudó. este es mi js tratando de publicar:

 const sendTest = () => { const data = createObject(); if (data == false) { alert("fill everything!"); } else { console.log(JSON.stringify(data)); const parameters = { method: "POST", body: JSON.stringify(data), credentials: "same-origin", headers: { "Content-Type": "application/json", }, }; fetch("http://127.0.0.1:3035/api/sendSoftSkills", parameters); } };

JSON.stringfy(datos):

 {"ss1":"1","ss2":"1","ss3":"1","ss4":"2","ss5":"2","ss6":"2","ss7":"2","ss8":"2","ss9":"2","ss10":"2","ss11":"2","ss12":"1","ss13":"2","ss14":"1","ss15":"2","ss16":"1","ss17":"2","ss18":"1","ss19":"1","ss20":"1"}

en mi node.js con express:

 app.post("/api/sendSoftSkills", (req, res) => { console.log("POSTED!"); console.log(req.body); });

mi terminal:

 POSTED! {}

Estoy usando un middleware analizador de cuerpo. ¿Me estoy perdiendo algo obvio? Cualquier ayuda apreciada, gracias!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Necesitas analizar el cuerpo:

 app.use(express.json()) app.post("/api/sendSoftSkills", (req, res) => { console.log("POSTED!"); console.log(req.body); });
about 4 years ago · Juan Pablo Isaza Report
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!