From c0e039f7f8b47448a235fd6c770eea70ef2c5241 Mon Sep 17 00:00:00 2001 From: Parkillhwan Date: Thu, 20 Mar 2025 00:04:10 +0900 Subject: [PATCH] =?UTF-8?q?DO=20-=2016=20=EB=9E=AD=ED=82=B9=20=EC=84=9C?= =?UTF-8?q?=EB=B2=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 2 +- routes/leaderboard.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 43d1298..dafba3d 100644 --- a/app.js +++ b/app.js @@ -75,7 +75,7 @@ app.use(express.static(path.join(__dirname, 'public'))); app.use('/', indexRouter); app.use('/users', usersRouter); -app.use('/leaderboard', leaderboardRouter); +app.use('/', leaderboardRouter); app.use('/coins', coinsRouter); // catch 404 and forward to error handler diff --git a/routes/leaderboard.js b/routes/leaderboard.js index 4cfe0dd..b3a5b41 100644 --- a/routes/leaderboard.js +++ b/routes/leaderboard.js @@ -3,7 +3,7 @@ const {ObjectId} = require("mongodb"); var router = express.Router(); // 랭킹 조회 -router.get("/", async function (req, res, next) { +router.get("/leaderboard", async function (req, res, next) { try { if(!req.session.isAuthenticated) { return res.status(403).send("로그인이 필요합니다."); @@ -35,7 +35,7 @@ router.get("/", async function (req, res, next) { lose: user.lose || 0, winRate: parseFloat(winRate.toFixed(2)), // 소수점 2자리까지 표시 totalGames: totalGames, - imageIndex: user.profileImageIndex, + profileImageIndex: user.profileImageIndex, }; }) .sort((a, b) => { @@ -46,9 +46,11 @@ router.get("/", async function (req, res, next) { return b.winRate - a.winRate; // 승률 내림차순 정렬 }); + console.log(userRating); + console.log(result); res.json({ rating: userRating, - leaderboardDatas : result ?? [] + scoreInfos : result ?? [] }); } catch(err) { console.error(err);