easy-mock简介
之前都是自己写加接口 很湿费劲 这个很方便 爱不释手
使用指南
基本语法 会随机发生变化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
109
110
111
112{
'basedate': {
"string|1-2": "@string",
"integer": "@integer(10, 30)",
"float": "@float(60, 100, 2, 2)",
"boolean": "@boolean",
"date": "@date(yyyy-MM-dd)",
"datetime": "@datetime",
"now": "@now",
"url": "@url",
"email": "@email",
"region": "@region",
"city": "@city",
"province": "@province",
"county": "@county",
"upper": "@upper(@title)",
"guid": "@guid",
"id": "@id",
"image": "@image(200x200)",
"title": "@title",
"cparagraph": "@cparagraph",
"csentence": "@csentence",
"range": "@range(2, 10)"
},
"base": {
"range": "@range(3, 7)",
"string": "@string(7, 20)",
"character": "@character('abcde')",
"float": "@float(60, 100)",
"integer": "@integer(60, 100)",
"natural": "@natural(60, 100)",
"boolean": "@boolean"
},
"date": {
"date": "@date",
"time": "@time",
"datetime": "@datetime",
"now": "@now"
},
"images": {
"ajax|1-10": "★",
"string2|3": "★★",
"number|+1": 202,
"number2|1-100.1-10": 1,
"boolean|1": true,
"regexp": /[a-z][A-Z][0-9]/,
"absolutePath": "@/string @/user/name",
"user": {
"name": "demo"
},
"object|2": {
"310000": "上海市",
"320000": "江苏省"
},
"array|1": ["AMD"]
},
"image": {
"image": "@image('200x100', '#50B347', '#FFF', 'EasyMock')"
},
"color": {
"color": "@color",
"hex": "@hex",
"rgb": "@rgb",
"rgba": "@rgba",
"hsl": "@hsl"
},
"text": {
"paragraph": "@paragraph(1, 3)",
"sentence": "@sentence(3, 5)",
"word": "@word(3, 5)",
"title": "@title(3, 5)",
"cparagraph": "@cparagraph(1, 3)",
"csentence": "@csentence(3, 5)",
"cword": "@cword('零一二三四五六七八九十', 5, 7)",
"ctitle": "@ctitle(3, 5)"
},
"name": {
"first": "@first",
"last": "@last",
"name": "@name",
"cfirst": "@cfirst",
"clast": "@clast",
"cname": "@cname"
},
"web": {
"url": "@url",
"domain": "@domain",
"protocol": "@protocol",
"tld": "@tld",
"email": "@email",
"ip": "@ip"
},
"address": {
"region": "@region",
"province": "@province",
"city": "@city(true)",
"county": "@county(true)",
"zip": "@zip"
},
"helper": {
"capitalize": "@capitalize('hello')",
"upper": "@upper('hello')",
"lower": "@lower('HELLO')",
"pick": "@pick(['a', 'e', 'i', 'o', 'u'])",
"shuffle": "@shuffle(['a', 'e', 'i', 'o', 'u'])"
},
"miscellaneous": {
"id": "@id",
"guid": "@guid",
"increment": "@increment(1000)"
}
}
参数配置
get
/:id/index
请求的时候可以配置参数