title: req.body gives empty object
body: <p>Hello i am building a REST api the problem is whenever i try to get information from the body i get a blank object. I've done this before and i know this is how its supposed to work so my guess is i made a silly mistake when configuring the server but so far i can't seem to find it. So i ask for your help!</p>
  <p>Here's my server file:</p>
  <pre><code>import dotenv from &quot;dotenv&quot;;
  dotenv.config();
  import express from &quot;express&quot;;
  import cors from &quot;cors&quot;;
  import router from &quot;./routes/router.js&quot;;
  import mongoose from &quot;mongoose&quot;
  
  mongoose.connect(process.env.MONGO_URI);
  const db = mongoose.connection;
  
  const app = express();
  
  const PORT = process.env.PORT || 8000;
  
  app.use(express.json());
  
  app.use(express.urlencoded({    extended:true   }));
  
  app.use(&quot;/&quot;, router);
  app.use(cors({
      origin: '*',
      methods: &quot;GET, POST, PUT, DELETE&quot;,
      optionsSuccessStatus: 200
  }));
  
  
  
  app.get(&quot;/&quot;, (req, res) =&gt; {
      res.json(&quot;Petko&quot;);
  });
  
  app.listen(PORT, console.log(`server runs at port: ${PORT}`));
  
  </code></pre>
  <p>Here's the route for the post request:</p>
  <pre><code>router.post(&quot;/articles/new&quot;, async(req, res) =&gt; {
      const body = req.body;
  
      console.log(body);
      const newArticle = new Articles({
          title: body.title,
          description: body.description,
          craetedat: body.craetedat,
          createdby: body.createdby,
      })
  
      try {
         const saveArticle = await newArticle.save();
         res.json(saveArticle); 
      } catch (err) {
          console.error(err.message);
      }
  });
  
  </code></pre>
  <p>And lastly here's the model schema:</p>
  <pre><code>import mongoose from &quot;mongoose&quot;
  
  const Schema = mongoose.Schema;
  
  const article = new Schema({
      title: {
          type: String,
          required:true
      },
      description: {
          type: String,
          required: true
      },
      createdat: {
          type: Date,
          required: true,
          default: Date.now
      },
      craetedby: {
          type: String,
          required: true
      }
  })
  
  
  const Article = mongoose.model(&quot;Articles&quot;, article);
  
  export default Article;
  
  </code></pre>
  <p>Thanks for your help in advance!</p>