title: Postman GET Request hangs and never returns any results
body: <p>I am attempting to Build A REST API With Node.js, Express, &amp; MongoDB. Everything seem to work so far. The server starts and connects to the DB. The DB (named API) has two collections (Articles and Sources). I am trying to send GET request to the Articles collection. However, when I send the request, Postman sort of hangs and then gives this an error and crashes the server:</p>
  
  <pre><code>Could not get any response
  There was an error connecting to localhost:3000/articles.
  Why this might have happened:
  The server couldn't send a response:
  Ensure that the backend is working properly
  Self-signed SSL certificates are being blocked:
  Fix this by turning off 'SSL certificate verification' in Settings &gt; General
  Proxy configured incorrectly
  Ensure that proxy is configured correctly in Settings &gt; Proxy
  Request timeout:
  Change request timeout in Settings &gt; General
  </code></pre>
  
  <p>The server throws the following error(s) when it crashes:</p>
  
  <pre><code>FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
   1: 0x10007e891 node::Abort() [/usr/local/Cellar/node/13.8.0/bin/node]
   2: 0x10007e9c0 node::OnFatalError(char const*, char const*) [/usr/local/Cellar/node/13.8.0/bin/node]
   3: 0x10017e6ab v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/Cellar/node/13.8.0/bin/node]
  </code></pre>
  
  <p>My code looks like the following:</p>
  
  <pre><code>require('dotenv').config()
  
  const express = require('express') 
  const app = express()
  const mongoose = require('mongoose')
  
  mongoose.connect(process.env.DATABASE_URL, { useNewUrlParser: true , useUnifiedTopology: true })
  const db = mongoose.connection
  db.on('error', (error) =&gt; console.error(error))
  db.once('open', () =&gt; console.log('Connected to Database'))
  
  app.use(express.json())
  
  const articlesRouter = require('./routes/articles')
  app.use('/articles', articlesRouter)
  
  app.listen(3000, () =&gt; console.log('Server Started'))
  </code></pre>
  
  <p>My routes; I'm attempting to send GET request to get All the articles in the DB (that are in the Articles collection):</p>
  
  <pre><code>const express = require('express')
  const router = express.Router()
  const Article = require('../models/articles')
  
  //Getting All Articles
  router.get('/', async (req, res) =&gt; {
    try {
        const articles = await Article.find()
        res.json(articles)
    } catch (err){
      res.status(500).json({message: err.message})
    }
  })
  
  //Getting One Article
  router.get('/:id', (req, res) =&gt; {
  
  })
  
  module.exports = router
  </code></pre>
  
  <p>If I change the <code>router.get</code> to this <code>router.get('/articles', async (req, res)</code> Postman will no longer hang, but throw the following error:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;Error&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;pre&gt;Cannot GET /articles&lt;/pre&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>And my routes:</p>
  
  <pre><code>const mongoose = require('mongoose')
  
  const articlesSchema = new mongoose.Schema({
      author: String, content: String, description: String, publishedAt: Date, source_id: String, summarization: String, title: String, url: String, urlToImage: String}, { collection: 'Articles'});
  
  module.exports = mongoose.model('article', articlesSchema)
  </code></pre>
  
  <p>As I mentioned in the beginning, this is my first attempt at building a REST API. Any help you can provide to help me figure out why a Postman GET request isn't going through, will be greatly appreciated. </p>