express app.get(' /* ') and api CORs issue
<p>can you tell me how I can get my json api? </p>

<p>server.js</p>

<pre><code>app.get('/*', function(req, res) {
    res.sendFile(path.join(__dirname, 'public', 'index.html'));
})

app.get('/api', function(req, res) {
    res.header()
res.json({'message' : 'hi this is my json obj'});
})
</code></pre>

<p>App.js </p>

<pre><code>class App extends React.Component {
    componentDidMount() {
    // let foo;
    axios.get('http://localhost:3000/api')
        .then(res =&gt; {
        console.log(res.data);
        res.data.message;
    })
    .catch(err =&gt; {
        console.log(err);
    })
  }
</code></pre>

<p>For some reason, like that I can get react router to access localhost:3000/dashboard just fine by inputing the url field. It is keep returning html string. what can i change to make it so that I can receive json object instead of html string?</p>