-
Notifications
You must be signed in to change notification settings - Fork 0
/
testAxios.js
40 lines (26 loc) · 921 Bytes
/
testAxios.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
const axios = require('axios')
const arrayName = require('./jsonObjects/RoleteNames')
console.log(arrayName.length)
function generateRandom(maxLimit = 100){
let rand = Math.random() * maxLimit;
rand = Math.floor(rand); // 99
return Math.round(rand);
}
const obj = {
}
obj.name = arrayName[generateRandom(18)]
obj.number = [generateRandom(39), generateRandom(39), generateRandom(39), generateRandom(39), generateRandom(39), generateRandom(39), generateRandom(39), generateRandom(39), generateRandom(39), generateRandom(39)]
obj.date = new Date().getTime()
setInterval(() => {
obj.number.pop()
obj.number.reverse()
obj.number.push(generateRandom(39))
obj.number.reverse()
console.log(obj.number)
obj.date = new Date().getTime()
axios.post('http://localhost:3055/api/evolution', obj).then((result) => {
console.log(result.data)
}).catch((erro) => {
console.log(erro)
})
}, 5000)