forked from big-tutu/roadhogWebpack4
-
Notifications
You must be signed in to change notification settings - Fork 2
/
devServer.mock.js
108 lines (106 loc) · 2.69 KB
/
devServer.mock.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
const mockjs = require('mockjs');
const proxy = {
'POST /midway/api/forms': (req, res) => {
res.send({message: 'Ok'});
},
'POST /api/login/account': (req, res) => {
const {password, userName, type} = req.body;
res.send({
status: password === '888888' && userName === 'admin' ? 'ok' : 'error',
type,
});
},
'POST /api/register': (req, res) => {
res.send({status: 'ok'});
},
'GET /api/500': (req, res) => {
res.status(500).send({
"timestamp": 1513932555104,
"status": 500,
"error": "error",
"message": "error",
"path": "/base/category/list"
});
},
'GET /api/404': (req, res) => {
res.status(404).send({
"timestamp": 1513932643431,
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/base/category/list/2121212"
});
},
'GET /api/403': (req, res) => {
res.status(403).send({
"timestamp": 1513932555104,
"status": 403,
"error": "Unauthorized",
"message": "Unauthorized",
"path": "/base/category/list"
});
},
'GET /midway/api/console/getUserVisitedProduct/*': (req, res) => {
res.send({
success: true,
data: [
{
type: 1,
id: 1,
name: 'es'
},
{
type: 1,
id: 2,
name: 'kafka'
}
],
});
},
'GET /midway/api/console/gettodothings': (req, res) => {
res.send({
success: true,
data: {
examine: 6,
error: 7,
workOrder: 8,
},
});
},
'GET /midway/api/console/getnotice': (req, res) => {
res.send({
success: true,
data: {
notice: [
{
id: 1,
title: '测试通知公告测试通知公告测试通知公告测试通知公告测试通知公告',
},
{
id: 2,
title: '测试通知公告测试通知公告测试通知公告测试通知公告测试通知公告',
},
{
id: 3,
title: '测试通知公告测试通知公告测试通知公告测试通知公告测试通知公告',
}
],
productMsg: [
{
id: 1,
title: '测试产品公告测试通知公告测试通知公告测试通知公告测试通知公告',
},
{
id: 2,
title: '测试产品公告测试通知公告测试通知公告测试通知公告测试通知公告',
},
{
id: 3,
title: '测试产品公告测试通知公告测试通知公告测试通知公告测试通知公告',
}
],
},
});
},
};
module.exports = proxy;