lib/mock/edit-resource.js
function overwriteResource (req, res, next, dataStore) {
  let resource = createResource(req);

  // Delete the existing resource, if any
  dataStore.delete(resource, (err) => {
    if (err) {
      next(err);
    }
    else {
      // Save the new resource
      util.debug("Saving data at %s", resource.toString());
      dataStore.save(resource, sendResponse(req, res, next, dataStore));
    }
  });
}
function overwriteResource (req, res, next, dataStore) {
  let resource = createResource(req);

  // Delete the existing resource, if any
  dataStore.delete(resource, (err) => {
    if (err) {
      next(err);
    }
    else {
      // Save the new resource
      util.debug("Saving data at %s", resource.toString());
      dataStore.save(resource, sendResponse(req, res, next, dataStore));
    }
  });
}
function overwriteResource ( req , res , next , dataStore ) { let resource = createResource ( req ) ; // Delete the existing resource, if any dataStore . delete ( resource , ( err ) => { if ( err ) { next ( err ) ; } else { // Save the new resource util . debug ( "Saving data at %s" , resource . toString ( ) ) ; dataStore . save ( resource , sendResponse ( req , res , next , dataStore ) ) ; } } ) ; }
Creates or overwrites the REST resource at the URL.

If the resource already exists, it is overwritten.
To merge with the existing data, use POST or PATCH instead of PUT.

@param   {Request}   req
@param   {Response}  res
@param   {function}  next
@param   {DataStore} dataStore
Creates or overwrites the REST resource at the URL .