вот код
if (req.url === '/login' && req.method === 'POST') {
console.log('login');
res.setHeader('content-type','application/json; charset=utf-8');
res.setHeader('Access-Control-Allow-Origin','*');
let data = '';
req.on('data',(dataSumbol) => {
data+=dataSumbol.toString();
})
req.on('end',async () => {
data = JSON.parse(data);
let infoBD = await db.find({email:data.email,password:data.password});
console.log('data',infoBD);
if (!infoBD) {
res.end(JSON.stringify({
resultCode:1,
textErorr:'ivalid login or password',
}));
return
} else {
res.end(JSON.stringify(infoBD));
}
})
return
}
текст отшибки
UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'NativeTopology'
| property 's' -> object with constructor 'Object'
| property 'sessionPool' -> object with constructor 'ServerSessionPool'