I have some inputs. User fills them and clicks send button. I want the data to store in database (couchDB).
The problem: I can save in database one object(div with multiple inputs).

But when the user creates another div with inputs and tries to send 2 of them or even more - I get an error

what I have so far:
this is the structure I am trying to send:
and this is a code:
App:
handleSubmit = (event) => {
event.preventDefault();
let myRequest = new Request(
'http://localhost:80/send',
{
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(
this.state.divs // <- here is an array of objects. Won't work.
// But if I send only the first one `this.state.divs[0]` it will do
// the job and data will be stored in database as on the first picture.
)
}
);
fetch(myRequest)
.then(res => res.json())
.catch(err => console.log(err))
};
Server:
server.post('/send', (req, res) => {
questionsDB.insert(
req.body
).then(
(antwort) => {
console.log(antwort);
res.send(JSON.stringify({
status: 'ok'
}))
}
);
});
What I am doing wrong? Would appreciate any help.
