Save an SQL object to a file using Node.js

  javascript, mysql, node.js, reactjs, sql

I need to save the object rows in a file or save it to a JSON file.

app.get('/getposts', (req, res) => {
  mysqlConnection.query('Select * from posts', (err, rows, fields) => {
    if (!err) console.log(rows);
    else
      console.log(err);

    res.send(rows);

Source: Ask Javascript Questions

LEAVE A COMMENT