diff --git a/app.js b/app.js index 20ab1a34ec4d14b5e43c1a16ca5ec88603bafe09..0fd3e42d11a9875ac5397049f08d329b161eedc4 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 06c4737ddcb9e57aaf2033d209acb76a4bfa0f51..a1dbda104009d67b9b42022262fc7f862891b1bb 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;