-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsample.js
More file actions
50 lines (48 loc) · 1.2 KB
/
sample.js
File metadata and controls
50 lines (48 loc) · 1.2 KB
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
var API = require('api-stub');
var setting = [{
path:'/data',
data: {
status: 'success',
data:['///item*10///'],
log:['///log*10///']
},
templates:{
item:{
random_amount:function(){
return Math.floor(Math.random())
},
amount:{
data:{
stub_type:'select',
choice:[100,200,300,400],
type:'liner'
}
},
id:{
stub_type:'number',
max_num:8000,
min_num:1000,
type:'random'
},
text:{
stub_type:'lipsum',
min_char_length:100,
max_char_length:300,
},
date:{
stub_type:'datetime',
output_format:'toYMDString',
type:'incremental',
starting_datetime:'2014-01-01',
increments:86400000
}
},
log:{
message:'message'
}
}
}];
var apiserver = new API(setting);
apiserver.start(3000, function(){
console.log(apiserver.profile.call(this));
});