title: How to give an attribute of a class the req.body values?
body: <p>I have a class which is a controller that executes a method when it is called from a route, and I am trying to give my dataStore attribute within the list method (defining it of any type, because I don't know what other type it could put) , the object that in theory should give me <code>req.body.¿</code>?</p>
  
  <p>This is being written in typescript, and requests are being sent through postman.</p>
  
  <pre><code>class RentController{
      private dataStore:any; 
  
      public search(req:Request, res:Response){
          this.dataStore= req.body; 
          res.send(this.dataStore);
      }
  }
  </code></pre>
  
  <p><br/>
  <a href="https://i.stack.imgur.com/LkUrH.png" rel="nofollow noreferrer">Here is what i sent by postman</a><br/>
  <a href="https://i.stack.imgur.com/cD0i1.png" rel="nofollow noreferrer">Here is what i recieved by postman</a><br/></p>
  
  <p>The error that throws me is:</p>
  
  <blockquote>
    <p>TypeError: Cannot set property 'dataStore' of undefined</p>
  </blockquote>