I\'m trying something simple where I make a request from the front end of my app using the fetch API like so
let request = new Request(\'http://localhost:3000/a
Could also split in to two like this
async fetchData() {
let config = {
headers: {
'Accept': 'application/json' //or text/json
}
}
fetch(http://localhost:3000/add`, config)
.then(res => {
return res.json();
}).then(this.setResults);
//setResults
setResults(results) {
this.details = results;
//or: let details = results
console.log(details) (or: this.details)