B
B
Bohdan Yurchuck2017-12-11 02:02:13
MongoDB
Bohdan Yurchuck, 2017-12-11 02:02:13

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

1 answer(s)
B
Bohdan Yurchuck, 2017-12-11
@Tigermax139

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 question

Ask a Question

731 491 924 answers to any question