-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.js
50 lines (32 loc) · 762 Bytes
/
demo.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
const server = require('./lib/server');
const axios = require('axios');
const s = server;
s.jsonFilePath = '../';
s.ini(['users', 'test', 'abc']);
s.app.listen(3000);
// testing
axios.get('http://localhost:3000/test')
.then(res => {
if (res.data.length > 5) {
axios.delete('http://localhost:3000/test');
}
});
const object = {
username: 'yo boi'
}
axios.post('http://localhost:3000/test', object)
.then(res => {
});
/*
axios.delete('http://localhost:3000/test/3')
.then(res => {
console.log(res.data);
}); */
const uObject = {
username: 'hgaha',
test: 'wef'
}
axios.patch('http://localhost:3000/test/2', uObject)
.then(res => {
console.log(res.data);
});