let data = new FormData()
data["json"] = JSON.stringify(mydata);
fetch(url, {
method: 'POST',
credentials: 'include',
body: data
}).then((res)=>{
// ....
}).catch(
//....
);
export async function post(req, res, next) {
console.log(req.body)
res.writeHead(200, {
'Content-Type': 'application/json'
});
}
export async function post(req, res, next) {
console.log(req.body) // вот для этого необходим body-parser
res.writeHead(200, {
'Content-Type': 'application/json'
});
}