const pool = require('../modules/db.js')
const express = require('express');
const router = express.Router();

let items = [
  { id: 1, name: 'Apple' },
  { id: 2, name: 'Banana' },
];

// GET 전체 목록
router.get('/', async (req, res) => {
  console.log(pool);
  try {
    const [rows] = await pool.query("SELECT * FROM TEST")
    res.json(rows);
  } catch(e) {
    console.error(e);
    res.json({});
  }
  
});

module.exports = router;