S
S
sinevik2018-10-23 12:41:44
Node.js
sinevik, 2018-10-23 12:41:44

Why is no response coming from the server?

Here is the request to the server

export const postYoutube = async (data) => {
  const result = await axios.post('http://localhost:5000/api/google', data);
  console.log(result);
};

Here is my route on the server
const express = require('express');
const bodyParser = require('body-parser');

const app = express();

app.use(bodyParser.json());
app.post('/api/google', (req, res) => {
  console.log(req.body);
  res.send('Server is running');
});

The data that I send to the server comes, it displays in the console. The question is why it does not send back Here it is empty
res.send('Server is running');
const result = await axios.post('http://localhost:5000/api/google', data);
  console.log(result);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton fon Faust, 2018-10-23
@bubandos

Look at the console.
I am tormented by vague doubts that you have mixed content.
The page is opened via https, and you send requests via http.
Through pribludy a la postman requests pass?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question