Answer the question
In order to leave comments, you need to log in
Is the edited text from the database displayed along with the tags?
I am writing an article for a blog in CKEditor, uploading it to the database. Then, when displayed on the page, the main test goes unformatted and along with tags.
I'm using the EJS template engine.
Maybe there are some filters or you can set the data type?
and here is the request
app.get('/single/:id', (req, res) => {
let id = new objectId(req.params.id);
MongoClient.connect(urlDB, (err, db) => {
db.collection("posts").findOne({_id: id}, (err, post) =>{
if(err) {
console.log(err);
return res.status(400).send();
}
db.close();
res.render('single', {
post
});
});
});
});
here is the template
<%= post.postContent %>
Answer the question
In order to leave comments, you need to log in
Folks, I found the error myself.
If you need to filter, you need to
replace = in the template
<%= post.postContent %> with -
<%- post.postContent %>. And all the norms plow
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question