Answer the question
In order to leave comments, you need to log in
How to make data exchange through axios correctly?
You need to do data exchange through two remote machines.
On the server I start the listener on port 3306 http.listen(3306) ...
On the client I send data:
await axios({
timeout: 10000,
method: 'post',
data: data
});
Data successfully arrives at the server.
How to send back data from the server to the client?
It turns out in the same way, through axios I send data to the client. And on the client I launch the http.listen(3306) port listener?
Goes to the server has axios and listener and on the client axios and listener. It turns out that the server is a client and the client is a server
Answer the question
In order to leave comments, you need to log in
You can't send data to the client in this way.
Let's start by sending data to the server using a specific route, for example test
Then your handler will look something like this:
router.get('/test', (req, res) => {
res.send('Даные, которые возвращаем обратно на клиент');
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question