Your task is to replace the blanks in the fetch options to correctly configure the request for creating a new user.
fetch API in Node.js
Creating a new user
Report a typo
Fill in the gaps with the relevant elements
async function createUser(userData) {
const response = await fetch('https://api.example.com/users', {
: 'POST',
headers: {
'Content-Type': 'application/json',
},
: JSON.stringify(userData),
});
const data = await response.json();
console.log('Created User:', data);
}
const newUser = {
name: 'Jane Doe',
email: '[email protected]',
};
createUser();Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.