journal.pl/stubs/api/index.js
2024-03-01 11:43:31 +03:00

32 lines
920 B
JavaScript

const router = require('express').Router()
const fs = require('node:fs')
const path = require('node:path')
router.get('/check', function (req, res) {
res.send({ ok: true })
})
router.get('/lesson/list', (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.send(require('../mocks/lessons/access-code/get/success.json'))
})
router.get('/api/lesson/:lessonId', (req, res) => {
res.send(require('../mocks/lessons/byid/success.json'))
})
module.exports = router