[feat] add chgk api
This commit is contained in:
parent
ff15a48414
commit
da84344a63
@ -3,6 +3,7 @@ const router = Router()
|
||||
|
||||
router.use('/eng-it-lean', require('./eng-it-lean/index'))
|
||||
router.use('/sberhubproject', require('./sberhubproject/index'))
|
||||
router.use('/sber_web', require('./sber_web/index'))
|
||||
|
||||
module.exports = router
|
||||
|
||||
|
8
server/routers/kfu-m-24-1/sber_web/index.js
Normal file
8
server/routers/kfu-m-24-1/sber_web/index.js
Normal file
@ -0,0 +1,8 @@
|
||||
const router = require('express').Router();
|
||||
const listRouter = require('./questions');
|
||||
const questionRouter = require('./question');
|
||||
|
||||
module.exports = router;
|
||||
|
||||
router.use('/questions', listRouter);
|
||||
router.use('/question', questionRouter);
|
16
server/routers/kfu-m-24-1/sber_web/question/index.js
Normal file
16
server/routers/kfu-m-24-1/sber_web/question/index.js
Normal file
@ -0,0 +1,16 @@
|
||||
const axios = require('axios');
|
||||
const router = require('express').Router();
|
||||
|
||||
module.exports = router;
|
||||
|
||||
router.get('/:id', async (req, res) => {
|
||||
const id = req.params.id;
|
||||
const baseUrl = 'http://www.db.chgk.info';
|
||||
try {
|
||||
const data = await axios.get(baseUrl + `/questions/${id}`);
|
||||
res.send(data.data);
|
||||
}
|
||||
catch (e) {
|
||||
res.send(undefined);
|
||||
}
|
||||
});
|
16
server/routers/kfu-m-24-1/sber_web/questions/index.js
Normal file
16
server/routers/kfu-m-24-1/sber_web/questions/index.js
Normal file
@ -0,0 +1,16 @@
|
||||
const axios = require('axios');
|
||||
const router = require('express').Router();
|
||||
|
||||
module.exports = router;
|
||||
|
||||
router.get('/:page', async (req, res) => {
|
||||
const page = req.params.page;
|
||||
const baseUrl = 'http://www.db.chgk.info';
|
||||
try {
|
||||
const data = await axios.get(baseUrl + `/questions?page=${page}&itemsPerPage=15`);
|
||||
res.send(data.data);
|
||||
}
|
||||
catch (e) {
|
||||
res.send(undefined);
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user