const mysql = require("mysql2");
const continueLearning = (req, res) => {
    // res.send(req.query.doa); //get
    // res.send(req.body.doa);  //post
    const connection = mysql.createConnection({
      host: process.env.MARIA_HOST,
      user: process.env.MARIA_USER,
      password: process.env.MARIA_PASS,
      database: process.env.MARIA_DBNM
    });
  
      connection.connect((err) => {
        if(err) {
            console.error('Error connecting to the database:', err);
            return;
        }
          console.log('Connected to the MariaDB database.');
        });
  
        const data = req.body;
  
        const query = `SELECT * FROM continue_learning`;  
        connection.query(query, (err, results) => {
            if (err) {
            console.error('Error inserting data:', err);
            res.status(500).send('Internal Server Error');
            return;
            }
            res.status(200).json(results);
        });
  };
  
  module.exports = continueLearning;













// let courseData = [
    //     {
    //       id : "1",
    //       title : "Life History of Dr. Maria Montessori",
    //       chapter : "1",
    //       Program : "Graduate Program",
    //       img : "/assets/course1.jpg"
    //     },
    //       {
    //       id : "2",
    //       title : "Introduction to Montessori Methods",
    //       chapter : "2",
    //       Program : "Graduate Program",
    //       img : "/assets/course2.jpg"
    //     },
    //     {
    //       id : "3",
    //       title : "Exercises on Practical Life",
    //       chapter : "3",
    //       Program : "Graduate Program",
    //       img : "/assets/course3.jpg"
    //     }
    // ];
    // res.json(courseData);