title: Access-Control-Allow-Origin header in the response must not be the wildcard '*'... Socket.io, NodeJs, ReactJs
body: <p>I'm new to <strong>socket.io</strong>. I have following code in my NodeJs/Express server</p>
  
  <pre><code>const http = require('http');
  const socketIo = require('socket.io');
  const app = express();
  const server = http.createServer(app);
  const io = socketIo(server);
  
  io.on('connection', socket =&gt; {
      console.log('New client connected');
      socket.on('disconnect', () =&gt; console.log('Client disconnected'));
      socket.emit('FromAPI', 'hello');
  });
  //My port here is 8848
  app.listen(app.get('port'), () =&gt; {
      logger.log('info', `Server started at :${app.get('port')}`);
  });
  </code></pre>
  
  <p>And following code in <strong>Client React app</strong> and my react app is hosted in port 3000 as <a href="http://localhost:3000" rel="nofollow noreferrer">http://localhost:3000</a></p>
  
  <pre><code>import socketIO from 'socket.io-client';
  componentDidMount() {
      const endPoint = 'http://127.0.0.1:8848';
      const socket = socketIO(endPoint);
      socket.on('FromAPI', data =&gt; console.log(data));
  
    }
  </code></pre>
  
  <p>With this code i got the following error on the browser console:</p>
  
  <blockquote>
    <p>polling-xhr.js:263 GET <a href="http://127.0.0.1:8848/socket.io/?EIO=3&amp;transport=polling&amp;t=MMT-4kl" rel="nofollow noreferrer">http://127.0.0.1:8848/socket.io/?EIO=3&amp;transport=polling&amp;t=MMT-4kl</a> 405 (Method Not Allowed)
    Failed to load <a href="http://127.0.0.1:8848/socket.io/?EIO=3&amp;transport=polling&amp;t=MMT-Aso" rel="nofollow noreferrer">http://127.0.0.1:8848/socket.io/?EIO=3&amp;transport=polling&amp;t=MMT-Aso</a>: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin '<a href="http://localhost:3000" rel="nofollow noreferrer">http://localhost:3000</a>' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.</p>
  </blockquote>
  
  <p>Anyone please help me with this problem.</p>