const router = require('express').Router() const fs = require('node:fs') const path = require('node:path') router.get('/course/list', (req, res) => { res.send(require('../mocks/courses/list/success.json')) }) router.get('/course/students/:courseId', (req, res) => { res.send(require('../mocks/courses/all-students/success.json')) }) router.post('/course', (req, res) => { res.send(require('../mocks/courses/create/success.json')) }) router.get('/lesson/list/:courseId', (req, res) => { res.send(require('../mocks/lessons/list/success.json')) }) router.post('/lesson', (req, res) => { res.send(require('../mocks/lessons/create/success.json')) }) router.post('/lesson/access-code', (req, res) => { const answer = fs.readFileSync(path.resolve(__dirname, '../mocks/lessons/access-code/create/success.json')) // res.send(require('../mocks/lessons/access-code/create/success.json')) res.send(answer) }) router.get('/lesson/access-code/:accessCode', (req, res) => { res.status(400).send(require('../mocks/lessons/access-code/get/error.json')) }) router.get('/lesson/:lessonId', (req, res) => { res.send(require('../mocks/lessons/byid/success.json')) }) module.exports = router