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

174
Views
Node.js POST: req.body empty

Backend newbie here! I am trying to post from my frontEnd js to Node, but the body of the request always come in empty. I have read tons of answers here, but none helped me. this is my js trying to post:

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(data):

{"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"}

on my node.js with express:

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

my terminal:

POSTED!
{}

I am using body-parser middleware. Am I missing something obvious? Any help appreciated, thank!

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

0

You need to parse the body:

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!