title: I didn't get response from the nodejs server. It showing undefine after request to server
body: <p><strong>I hosted website on two different platforms like Firebase and Heroku</strong><br/>
  <strong>I Have some issues with that</strong><br/></p>
  <ol>
  <li>Firstly, It showing cors errors when I post data from firebase hosted URL to the server which is hosted on Heroku</li>
  <li>Then after resolving cors errors data couldn't from the server it showing undefined in console<br/>
  <strong>Here is my server-side code which is hosted on Heroku</strong></li>
  </ol>
  <pre><code>const express = require('express')
  const path = require('path')
  const PORT = process.env.PORT || 3000
  const app = express()
  const bodyParser = require('body-parser')
  app.use(bodyParser.urlencoded({extended:false}))
  app.use(bodyParser.json())
  
  app.use(express.json({limit:'1mb'}))
  
  app.use(function (req, res, next) {
  
  res.header('Access-Control-Allow-Origin', 'https://sample-377b8.web.app');
  res.header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
  res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With,content-type,Accept,Authorization',);
  res.header('Access-Control-Allow-Credentials', true);
  if(req.method==&quot;OPTIONS&quot;){
    res.header('Access-Control-Allow-Methods','PUT,POST,DELETE,PATCH')
    return res.status(200).json({})
  }
  // Pass to next layer of middleware
  next();
  });
  let data;
  app.get('/',(req,res)=&gt;{
  res.send(&quot;hello world&quot;)
  }) 
  app.post('/',(req,res)=&gt;{
   
    data = req.body
   console.log(data)
   res.status(200).json({
    &quot;success&quot;:&quot;200 response&quot;,
    &quot;res&quot;:&quot;You are now just talked with server&quot; 
   })
  
  })
  
  
  app.listen(PORT, () =&gt; console.log(`Listening on ${ PORT }`))
  
  </code></pre>
  <p><strong>This is my client side code</strong></p>
  <pre><code>document.getElementById('send').addEventListener('click',async()=&gt;{
             let data = {lat,lon}
              await fetch('https://demoserver-app.herokuapp.com/',{mode:&quot;no-cors&quot;},{
              method: 'POST', // or 'PUT'
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(data),
             }).then( async (dat) =&gt;{
               console.log(res.json())
             }).then(res =&gt;{
                 console.log(res)
             })
         })
  </code></pre>
  <p>It is giving the error on a console like
  <a href="https://i.stack.imgur.com/qy3WJ.jpg" rel="nofollow noreferrer">console error</a> image</p>
  <p>Headers information in the network tab
  <a href="https://i.stack.imgur.com/rJ1gb.jpg" rel="nofollow noreferrer">Header information of request</a> image</p>