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/deb'; 

// The data will be sent in the `body` property of 
// the fetch request and stored with the user data in the database (collection)
const userData =  { 
  // Remember that we don't have to specify the username in the data 
  // sent with the request because the server inserts the username from the URL into the data sent to the Mongo collection.
  pass: '1234' // here is the user password 
};

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(userData), // body data type must match "Content-Type" header
})