Q
Q
qqqZXzz1232021-09-05 12:59:06
Node.js
qqqZXzz123, 2021-09-05 12:59:06

How to get response from http server?

var fetch = require('node-fetch');
function getcode(data) {
fetch("http://127.0.0.1:9000/?"+data, {
    method: 'GET',
    body: null,
    headers: { 'Content-Type': 'application/json' }
})
  .then(res => res.json())
  .then(return json)//как сделать чтобы ретурн работал?
}
var code = getcode("данные_на_сервер")
console.log(code)


what can be corrected in the code, replaced?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question