Takze x sa konecne vypisuje. Vdaka. Len ono je to cele k nicomu ked to nejde odoslat ako json.
app.post('/', async (req, res) => {
const x = await translate(req.body.query, req.body.to);
console.log(x); // funguje
res.json(x); // chyba
})
chyba:
UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'ClientRequest'
| property 'socket' -> object with constructor 'TLSSocket'
--- property '_httpMessage' closes the circle...
skusal som to zapisat aj cez try a catch priamo v tom post route, no stale rovnaka chyba