29 lines
730 B
JavaScript
29 lines
730 B
JavaScript
|
|
import express from "express";
|
||
|
|
import pool from "../lib/db.js";
|
||
|
|
|
||
|
|
const router = express.Router();
|
||
|
|
|
||
|
|
// 통계 조회 (멤버 수, 앨범 수)
|
||
|
|
router.get("/", async (req, res) => {
|
||
|
|
try {
|
||
|
|
const [memberCount] = await pool.query(
|
||
|
|
"SELECT COUNT(*) as count FROM members"
|
||
|
|
);
|
||
|
|
const [albumCount] = await pool.query(
|
||
|
|
"SELECT COUNT(*) as count FROM albums"
|
||
|
|
);
|
||
|
|
|
||
|
|
res.json({
|
||
|
|
memberCount: memberCount[0].count,
|
||
|
|
albumCount: albumCount[0].count,
|
||
|
|
debutYear: 2018,
|
||
|
|
fandomName: "flover",
|
||
|
|
});
|
||
|
|
} catch (error) {
|
||
|
|
console.error("통계 조회 오류:", error);
|
||
|
|
res.status(500).json({ error: "통계 정보를 가져오는데 실패했습니다." });
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
export default router;
|