V
V
Vladimir2020-12-25 23:40:14
MySQL
Vladimir, 2020-12-25 23:40:14

How to write html string + text to database?

Good evening. Please tell me what I need to use in the request or what type of field to choose to write html + text data into the table field? Now all html is completely ignored for me and only text is written.

The request is the simplest

app.post('/createArticle', (req, res) => {

    const { name, img, text, url } = req.body;

    pool.query('insert into articles set ?', { name, img, text, url }, (err, res) => {
        err ? console.log(err) : console.log(res);
    });

    pool.query('select * from articles', (err, res) => {
       console.log(res.map(el => el))
    });

});


Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question