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

140
Views
I can not get request in body format in Node.js

I have problems receiving request in body format on my server.

I am using Express version 4.17.1. The documentation indicates that I don't have to use body-parserer, but I can do it directly with the express functionality "express.json ()"

However, I've been trying to get it to work for a long time but nothing happens: the console does not show anything. It seems that it does not recognize the request at all.

I'm doing all the request from Postman in body format JSON.

This is my code:

const express = require("express");
const formidable = require("express-formidable");
const cors = require("cors");
const dotenv = require("dotenv").config();

const app = express();
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.use(formidable());
app.use(cors());

(...)

app.post("/list", async (req, res) => {
  try {
    console.log(req.body);
  } catch (error) {
    return res.status(400).json({ message: error.message });
  }
});

What am I doing wrong?

Thank you very much for your time and help in advance.

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

0

Express parse request body according to defined type in Content-Type header. Try to do request with header Content-Type: application/json.

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!