title: "Error: socket hang up" error displayed when using Postman with ReactJS and MongooseDB
body: <p>I'm following a tutorial for setting up a React application with MongooseDB, Express etc. I'm using Postman for GET, POST. See code below (I've starred the password from the database string).</p>
  <p>When I send GET HTTP://localhost:8001 it shows &quot;hello world&quot; which I expect.</p>
  <p>When I send GET HTTP://localhost:8001/tinder/cards it hangs and eventually displays the error &quot;Error: socket hang up&quot;.</p>
  <p>When I send POST HTTP://localhost:8001/tinder/cards it hangs and eventually gives a 500 Internal Server error.</p>
  <p>Can anyone point me in the direction of where to debug please? I'm guessing the connection works as when I send GET HTTP://localhost:8001 it shows &quot;hello world&quot;.</p>
  <p>Thanks again.</p>
  <pre><code>import express from 'express'
  import mongoose from 'mongoose'
  import Cards from './dbCards.js'
  import Cors from 'cors'
  
  // App Config
  const app = express();
  const port = process.env.PORT || 8001
  const connection_url = `mongodb+srv://admin:*******@cluster0.iyemf.mongodb.net/tinder-db?retryWrites=true&amp;w=majority`
  
  // middlewares
  app.use(express.json())
  app.use(Cors())
  
  // db config
  mongoose.connect(connection_url, {
      useNewUrlParser: true,
      useCreateIndex: true,
      useUnifiedTopology:true,
  })
  
  // api endpoints
  app.get('/', (req, res) =&gt;  res.status(200).send(&quot;hello world&quot;));
  
  
  app.post('/tinder/cards', (req, res) =&gt; {
      const dbCard = req.body;
  
      Cards.create(dbCard, (err, data) =&gt; {
          if (err) {
              res.status(500).send(err)
          } else {
              res.status(201).send(data)
          }
      })
  })
  
  app.get(&quot;/tinder/cards&quot;, (req, res) =&gt; {
      Cards.find((err, data) =&gt; {
          if (err) {
              res.status(500).send(err)
          } else {
              res.status(200).send(data)
          }
      });
  });
  
  // listener
  app.listen(port, () =&gt; console.log(`listening on localehost: ${port}`)); 
  </code></pre>