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

70
Views
sending JSON using post but getting empty object instead of data

this is my code which is getting an JSON from post request I have connected the database in other file and it is getting connected when I send data from JSON empty object getting printedd

 const express=require('express');
    const app =new express()
    const User=require('../2-mongoose/3-user')
    require('../2-mongoose/1-basic');// have to add this ccompulsory


app.use(express.json())// will convert string into obj
app.post('/users',(req,res)=>{
    console.log(req.body);// to console.log data sent through json
    res.send("testing");
    // const user=new User(req.body);
    // user.save().then(()=>{
    //     res.send(user);
    // }).catch((error)=>{
    //     res.status(400).send(error);
    // })
})
app.listen(8000,()=>{
    console.log("server fired off");
})
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!