Skip to content

Commit 3ab1eed

Browse files
committed
Merge branch 'development'
2 parents fe641a7 + b3b756a commit 3ab1eed

File tree

6 files changed

+46
-7
lines changed

6 files changed

+46
-7
lines changed

axios/curlusers

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
curl localhost:3000/users/2/

axios/deluser.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env node
2+
const axios = require("axios");
3+
4+
async function makePostRequest() {
5+
try {
6+
let res = await axios.delete("http://localhost:3000/users/2/");
7+
console.log(res.status);
8+
} catch (err) {
9+
console.error(err.message);
10+
}
11+
}
12+
13+
makePostRequest();

axios/getusers.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env node
2+
const axios = require("axios");
3+
4+
async function makeGetRequest() {
5+
let res = await axios.get("http://localhost:3000/users/");
6+
let data = res.data;
7+
console.log(data);
8+
}
9+
10+
makeGetRequest();
11+

axios/jsonserver

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
json-server --watch users.json

axios/postuser.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env node
2+
const axios = require("axios");
3+
4+
async function makePostRequest() {
5+
6+
let params = {
7+
id: 6,
8+
first_name: "Fred",
9+
last_name: "Blair",
10+
11+
};
12+
13+
let res = await axios.post("http://localhost:3000/users/", params);
14+
console.log(res.data);
15+
}
16+
17+
makePostRequest();

axios/users.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
"last_name": "Schwartz",
77
"email": "[email protected]"
88
},
9-
{
10-
"id": 2,
11-
"first_name": "Lucy",
12-
"last_name": "Ballmer",
13-
"email": "[email protected]"
14-
},
159
{
1610
"id": 3,
1711
"first_name": "Anna",
@@ -31,4 +25,4 @@
3125
"email": "[email protected]"
3226
}
3327
]
34-
}
28+
}

0 commit comments

Comments
 (0)