

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: HTTP Methods - GET
incomplete
2: Why Use HTTP Methods?
incomplete
3: POST Requests
incomplete
4: Status Codes
incomplete
5: Status Code Property
incomplete
6: PUT
incomplete
7: PATCH vs. PUT
incomplete
8: Delete
incomplete
This lesson's interactive features are locked, please to keep using them
An HTTP POST request sends data to a server, typically to create a new resource.
The body of the request is the payload sent to the server. The special Content-Type header is used to tell the server the format of the body: application/json for JSON data in our case. POST requests are generally not safe methods to call multiple times because that would create duplicate records. For example, you wouldn't want to accidentally send a tweet twice.
await fetch(url, {
method: "POST",
mode: "cors",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
We need to save newly created users on our Jello server. We will use the getUsers function we created in the last exercise to make sure our creation logic is working.
Let's create the createUser() function. It should: