Answer the question
In order to leave comments, you need to log in
How to render the page and pass the data to the script?
Guys, good afternoon! Please tell me the following!
I have a router:
router.get('/', function(req, res) {
News.findAll({
raw: true,
attributes: ['id', 'link'],
where: { id: { [Op.gt]: 0 } },
})
.then((data) => {
res.render('index', {
auth: req.isAuthenticated(),
data: data,
});
console.log(data);
})
.catch((err) => console.log(err));
});
Answer the question
In order to leave comments, you need to log in
Damn, guys, I asked such crap, I just got confused that I didn’t open the data object as data[0].link and thought that it doesn’t work in the sript tag, sorry, the question is closed, figured it out!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question