1
I use the following code
var app = website.findOne({ where: { idwebsite: req.params.id } })
res.send(app);
But the result on the screen is that {"isFulfilled":false,"isRejected":false} How do I save the real value of select in the app variable?
1
I use the following code
var app = website.findOne({ where: { idwebsite: req.params.id } })
res.send(app);
But the result on the screen is that {"isFulfilled":false,"isRejected":false} How do I save the real value of select in the app variable?
0
Hello,
For the error presented you must be receiving a file as return, there are two ways to connect with asynchronous situations in javascript
Using async/await
async getData() {
  return await website.findOne({ where: { idwebsite: req.params.id } })
} 
const app = await getData();
res.send(app);
unless mistake so would already work:
getData() {
  return website.findOne({ where: { idwebsite: req.params.id } })
} 
const app = await getData();
res.send(app);
or dealing with the Privileges by then/catch
let app;
website.findOne({ where: { idwebsite: req.params.id } }).
then( data => {
  app = data;
  res.send(app);
})
ps. these codes have not been tested
Browser other questions tagged javascript node.js sequelize-js
You are not signed in. Login or sign up in order to post.