From f7b3acd89713ab2bb3ac09c9ac89e79091a626ff Mon Sep 17 00:00:00 2001 From: Wo-ogie <siwall0105@gmail.com> Date: Fri, 24 Nov 2023 20:57:49 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20participant=20router=EC=9D=98=20bas?= =?UTF-8?q?e=20endpoint=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/participant.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app.js b/app.js index 20ab1a3..0fd3e42 100644 --- a/app.js +++ b/app.js @@ -49,7 +49,7 @@ app.use( ); app.use('/meetings', meetingRouter); -app.use('/meetings', participantRouter); +app.use('/meetings/:meetingId/participants', participantRouter); app.use((req, res, next) => { const error = new Error(`There is no router. ${req.method} ${req.url}`); diff --git a/routes/participant.js b/routes/participant.js index 06c4737..a1dbda1 100644 --- a/routes/participant.js +++ b/routes/participant.js @@ -6,14 +6,14 @@ const { getParticipantExistence, } = require('../controllers/participant'); -const router = express.Router(); +const router = express.Router({ mergeParams: true }); -router.post('/:meetingId/participants', createParticipant); +router.post('/', createParticipant); -router.get('/:meetingId/participants', getParticipantByName); +router.get('/', getParticipantByName); -router.get('/:meetingId/participants/:participantId', getParticipantById); +router.get('/:participantId', getParticipantById); -router.get('/:meetingId/participants/existence', getParticipantExistence); +router.get('/existence', getParticipantExistence); module.exports = router; -- GitLab