Merge branch 'example' of inno-js/multy-stub into master

This commit is contained in:
grinikita 2023-11-20 15:58:35 +00:00 committed by Gogs
commit b40efa6797
4 changed files with 59 additions and 0 deletions

View File

@ -58,6 +58,7 @@ app.use('/zoom-bar', require('./routers/zoom-bar'))
app.use('/basket', require('./routers/basket')) app.use('/basket', require('./routers/basket'))
app.use('/easy-project', require('./routers/easy-project')) app.use('/easy-project', require('./routers/easy-project'))
app.use('/sugarbun', require('./routers/sugarbun')) app.use('/sugarbun', require('./routers/sugarbun'))
app.use('/epja-2023-2', require('./routers/epja-2023-2'))
require('./routers/hub-video') require('./routers/hub-video')
app.use(require('./error')) app.use(require('./error'))

View File

@ -0,0 +1,26 @@
const express = require("express");
const router = express.Router()
const waitMiddleware = (req, res, next) => {
setTimeout(() => {
next()
}, 3000)
}
const listActivated = true
router.get('/list', waitMiddleware, (req, res) => {
req.user
if (listActivated) {
res.status(200).send(require('./news.json'))
} else {
res.status(500).send()
}
})
router.get('/list-activate-toggle', (req, res) => {
listActivated = !listActivated
res.send(listActivated ? 'Activated' : 'Deactivated')
})
module.exports = router

View File

@ -0,0 +1,25 @@
{
"ok": true,
"data": [
{
"id": "1",
"name": "Some name 1",
"description": "Some long long long long description"
},
{
"id": "2",
"name": "Some name 2",
"description": "Some long long long long description"
},
{
"id": "3",
"name": "Some name 3",
"description": "Some long long long long description"
},
{
"id": "4",
"name": "Some name 4",
"description": "Some long long long long description"
}
]
}

View File

@ -0,0 +1,7 @@
const express = require('express')
const router = express.Router()
router.use('/example', require('./example/index'))
module.exports = router