title: Express with FIREBASE I get TypeError: Cannot read property 'trim' of undefined
body: <p>I'm working in a firebase project, and I'm trying to follow a tutorial and I can find the fix. 
  I have seen this type of validation in other projects and it should work, but I don't know what I'm missing in my code.</p>
  
  <p>I getting  </p>
  
  <blockquote>
    <p><em>TypeError: Cannot read property 'trim' of undefined</em></p>
  </blockquote>
  
  <p>This is for a POST request </p>
  
  <pre><code>exports.createContact= (req, res)=&gt;{
      if (req.body.body.trim() === '') {   // ERROR HERE WHEN VALIDATING
  
      return res.status(400).json({ body: 'Body must not be empty' });
    }
  ...
  }
  </code></pre>
  
  <p>This is the index.js </p>
  
  <pre><code>"use strict";
  const functions = require('firebase-functions');
  const express = require('express');
  const app = express();
  const {createContact}= require('./handlers/contacts');
  
  //middle ware 
  
  app.use(express.json());
  app.use(express.urlencoded({ extended: false }));
  
  // server functions
  
  app.post('/contact', createContact);
  
  exports.api = functions.https.onRequest(app);
  </code></pre>
  
  <p>Thanks for your help </p>