I have a server-side function that outputs a value from a database to /.netlify/functions/todos-read
I need to read it on another page, however the read() function returns undefined instead.
Here is what i tried:
function read() {
fetch('/.netlify/functions/todos-read').then(res => res.json()).then((out) => {
return out
}).catch(err => console.error(err));
}
Here is what i expected it to return:
{"ref":{"@ref":{"id":"236323245287014920","class":{"@ref":{"id":"nappi","class":{"@ref":{"id":"classes"}}}}}},"ts":1561634259400000,"data":{"value":1}}