A vscode extension for mock data
EasyMock.mockFolderName
: Any legal file nameEasyMock.serverPort
: Set the port number of the mock serverEasyMock.mockParse
: Enable build-in mock parseEasyMock.helloPage
: Enable hello page on startEasyMock.corsHeaders
: Customize header namesEasyMock.responseTime
:Set response time
Press F1
and type EasyMock
, select one of the following list item:
EasyMock: Run EasyMock
to run mock serverEasyMock: Stop EasyMock
to stop mock server
After select EasyMock: Run EasyMock
,to view the example file at {workspace}/{mockFolderName}/example.js
{
"age|1-80":0
}
{
"age":33
}
{
"name|1-5":"a"
}
{
"name":"aaa"
}
{
"color|2":["red","blue","yellow","black"]
}
{
"color":["blue","red"]
}
{
"color|1-5":["red","blue","yellow","black"]
}
{
"color":["blue","red","blue"]
}
{
"province|2":{
"110000": "北京市",
"120000": "天津市",
"130000": "河北省",
"140000": "山西省"
}
}
{
"province":{
"120000": "天津市",
"140000": "山西省"
}
}
{
"bool|1-2":true
}
{
"bool":false
}
{
age: function(){
return 18
},
name: function(buildInFns){
return buildInFns.cstr(2,4)
},
id: buildInFns=>buildInFns.inc(100)
}
{
age: 18,
name: '张三',
id: 109
}
str(min = 1, max = 10)
random stringcstr(min = 1, max = 10)
random chinese stringnum(min = 0, max = 999999999, digit)
random numberimg(w = 100, h = 100, bg, fg, format, text)
generate image urlcolor()
random hex colortime(future=false)
random timestampuuid()
random uuidinc(init)
increament integerparagraph(min = 1, max = 5)
generate paragraphcparagraph(min = 1, max = 5)
generate chinese paragraphpick([1,2,3,4,5])
pick a element from array or argumentsurl()
generate urlemail()
generate emailhost()
generate hostip()
generate ipphone()
generate phoneqq()
generate qq
{
id:"@inc(10000)",
age:"@num(18,60)",
avatar:"@img(100,100,'#f00','#fff','png')",
uuid: "@uuid",
desc: "@cparagraph"
}
{
"id": "10000",
"age": "28",
"avatar": "http://dummyimage.com/100x100/f00/fff.png",
"uuid": "8f3512d2-a86e-4008-b322-bd341c71d4ea",
"desc": "拥须吧诗神居间物吸跳场少是卫系听满间场歌。"
}