title: API resolved without sending a response in Nextjs
body: <p>I have to make same changes in my nextjs project because my enpoint API doesn't support many calls and I would like to make a refresh from the original data every 3 min.</p>
  <p>I implemented API from nextjs: I create a <code>pages/api/data</code> and inside I make the call to my endpoint, and in my <code>getInitialProps</code> inside index call to data file.</p>
  <p>The get works okey, but I have 2 problems:</p>
  <p><strong>1:</strong> I have and alert message that says:</p>
  <blockquote>
  <p>API resolved without sending a response for /api/data, this may result in stalled requests.</p>
  </blockquote>
  <p><strong>2:</strong> It dosen 't reload data after 3 min..I supouse it is beacuse Cache-Control value...</p>
  <p>This is my code:</p>
  <p><strong>pages/api/data</strong></p>
  <pre><code>import { getData } from &quot;../../helper&quot;;
  
  export default async function(req, res) {
    getData()
      .then(response =&gt; {
        res.statusCode = 200
        res.setHeader('Content-Type', 'application/json');
        res.setHeader('Cache-Control', 'max-age=180000');
        res.end(JSON.stringify(response))
      })
      .catch(error =&gt; {
        res.json(error);
        next();
      });
  };
  </code></pre>
  <p><strong>pages/index</strong></p>
  <pre><code>import React, { useState, useEffect } from &quot;react&quot;;
  import fetch from 'isomorphic-unfetch'
  
  const Index = props =&gt; {
  
    return (
      &lt;&gt;Hello World&lt;/&gt;
    );
  };
  
   Index.getInitialProps = async ({ res }) =&gt; {
    const response = await fetch('http://localhost:3000/api/data')
    const users = await response.json()
    return { users }
  };
  
  export default Index;
  </code></pre>