From 815832d2fbdbf61e471bcbc5b644874f2982ec6d Mon Sep 17 00:00:00 2001 From: maratsadykov Date: Fri, 4 Aug 2023 14:22:10 +0300 Subject: [PATCH] lobsters allcourses --- server/index.js | 1 + server/routers/lobsters/index.js | 13 +++++++++++ server/routers/lobsters/stubs/allCourses.json | 22 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 server/routers/lobsters/index.js create mode 100644 server/routers/lobsters/stubs/allCourses.json diff --git a/server/index.js b/server/index.js index 96f61f7..7138105 100644 --- a/server/index.js +++ b/server/index.js @@ -40,6 +40,7 @@ app.use(require('./root')) /** * Добавляйте сюда свои routers. */ +app.use('/lobsters', require('./routers/lobsters')) app.use('/example', require('./routers/example')) // app.use('/coder', require('./routers/coder')) app.use('/stc-21-03', require('./routers/stc-21-03')) diff --git a/server/routers/lobsters/index.js b/server/routers/lobsters/index.js new file mode 100644 index 0000000..252264a --- /dev/null +++ b/server/routers/lobsters/index.js @@ -0,0 +1,13 @@ +const router = require('express').Router() + +const first = router.get('/allcourses', (req, res) => { + res.send(require('./stubs/allCourses.json')) + + /** + * Этот эндпоинт будет доступен по адресу http://89.223.91.151:8080/multystub/example/first + */ +}) + +router.use('/example-api', first) + +module.exports = router diff --git a/server/routers/lobsters/stubs/allCourses.json b/server/routers/lobsters/stubs/allCourses.json new file mode 100644 index 0000000..fb12a59 --- /dev/null +++ b/server/routers/lobsters/stubs/allCourses.json @@ -0,0 +1,22 @@ +{ + "body": { + "availableCourses": [ + { + "id": "1", + "title": "Основы JS (difficulty 1)", + "duration": "6 месяцев", + "difficulty": 1, + "startDate": "2023-04-14T12:54:01.174Z", + "endDate": "2023-12-14T12:54:01.174Z" + }, + { + "id": "2", + "title": "Основы JS (difficulty 2)", + "duration": "6 месяцев", + "difficulty": 2, + "startDate": "2023-04-14T12:54:01.174Z", + "endDate": "2023-10-14T12:54:01.174Z" + } + ] + } +}