Answer the question
In order to leave comments, you need to log in
How to send array to node from js?
I make a POST request, and there is a json line in it, which should go to the node and already be written to the json document there,
it looks like this:
postJson(data){
return fetch('todo.json', {
method: 'POST',
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json'
}
})
.then(response => {response.json()})
.then(function(response) {
console.info('fetch()', response);
});
},
this.postJson(this.todos)
.then(()=>{
console.log(this.todos)
})
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