From 8cf407510fc3616ae11280b585ab031c151b7bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A1=B0=EB=8C=80=ED=9D=AC?= <joedaehui@ajou.ac.kr> Date: Fri, 15 Nov 2024 11:10:02 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=8A=A4=EC=BC=80=EC=A4=84=20=EB=9D=BC?= =?UTF-8?q?=EC=9A=B0=ED=84=B0=20=EC=9E=91=EC=84=B1=20(#6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/scheduleController.js | 2 +- routes/schedule.js | 44 +++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/controllers/scheduleController.js b/controllers/scheduleController.js index 5db38ca..6cfc2d0 100644 --- a/controllers/scheduleController.js +++ b/controllers/scheduleController.js @@ -108,7 +108,7 @@ class scheduleController { /** * 해당 사용자 전체 스케줄 조회 - * GET /api/schedules + * GET /api/schedule/all */ async getAllSchedules(req, res) { try { diff --git a/routes/schedule.js b/routes/schedule.js index e69de29..35da45e 100644 --- a/routes/schedule.js +++ b/routes/schedule.js @@ -0,0 +1,44 @@ +const express = require('express'); +const router = express.Router(); +const { isLoggedIn } = require('../middlewares/auth'); +const ScheduleController = require('../controllers/scheduleController'); + +/** + * 스케줄 API 라우트 + * 기본 경로: /api/schedule -> app.js에서 등록 + * isLoggedIn 미들웨어 사용해서 인증 체크 + */ +router.use(isLoggedIn); + +/** + * 전체 스케줄 조회 + * GET /api/schedule/all + */ +router.get('/all', ScheduleController.getAllSchedules); + +/** + * 개별 스케줄 조회 + * Get /api/schedule/:id + */ +router.get('/:id', ScheduleController.getScheduleById); + +/** + * 스케줄 생성 + * POST /api/schedule + */ +router.post('/', ScheduleController.createSchedule); + +/** + * 스케줄 수정 + * PUT /api/schedule/:id + */ +router.put('/:id', ScheduleController.updateSchedule); + +/** + * 스케줄 삭제 + * DELETE /api/schedule/:id + */ +router.delete('/:id', ScheduleController.deleteSchedule); + + +module.exports = router; \ No newline at end of file -- GitLab