2025-08-16 14:19:20 +09:00
|
|
|
const pool = require('../modules/db.js')
|
2025-08-14 23:34:11 +09:00
|
|
|
const express = require('express');
|
|
|
|
|
const router = express.Router();
|
|
|
|
|
|
|
|
|
|
let items = [
|
|
|
|
|
{ id: 1, name: 'Apple' },
|
|
|
|
|
{ id: 2, name: 'Banana' },
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// GET 전체 목록
|
2025-08-16 14:19:20 +09:00
|
|
|
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({});
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-14 23:34:11 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
module.exports = router;
|