post data to mongodb database without reloading the page using node.js code example
Example: show data of mongoose in html page using ejs
app.get('/profileface', isLoggedIn, function(req, res) {
// mongoose operations are asynchronous, so you need to wait
PracticeModel.find({}, function(err, data) {
// note that data is an array of objects, not a single object!
res.render('profileface.ejs', {
user : req.user,
practices: data
});
});
});