Edit in JSFiddle

// The URL for the request. 
// Remember that the first route parameter is the username of the user to create
const postURL = 'http://localhost:4567/dan'; 

// The extra data will be sent in the `body` property of 
// the fetch request and stored with the user data in the database (collection)
const extraDataToStore =  { 
  eyeColor: 'blue', 
  hairColor: 'brown',
  pass: 'mypassword123'
};

fetch(postURL, {
        method: 'POST', // Using POST request to create a new resource in the database
        mode: 'cors', // no-cors, cors, *same-origin
        cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
        credentials: 'same-origin', // include, *same-origin, omit
        headers: {
            'Content-Type': 'application/json',
        },
        redirect: 'follow', // manual, *follow, error
        referrer: 'no-referrer', // no-referrer, *client
        body: JSON.stringify(extraDataToStore), // body data type must match "Content-Type" header
})