Answer the question
In order to leave comments, you need to log in
What is the correct way to deploy an application to Heroku?
I can’t figure out how to correctly specify the links, that is, if I opened the application locally, then the Express server was on localhost:3003 and the React front was on localhost:3000 .
It's all logical. During the request through axios, the main link was indicated
, that is, the request is made to the backend.
Same with Socket.IO during connectaaxios.defaults.baseURL = http://localhost:3003
io(http://localhost:3003, { transports: ['websocket'] });
app.use('/', express.static(path.join(__dirname, '../build')));
app.get('/*', (req: any, res: any) => {
res.sendFile(path.resolve(__dirname, '../build', 'index.html'));
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question